Part Number Hot Search : 
STM32F CF5600 D74LV2 TR0013A SFFD450M ASOF3S3 SI442 AB310S
Product Description
Full Text Search
 

To Download MPC823UMREV116-CPM7 Datasheet File

  If you can't view the Datasheet, Please click here to try to view without PDF Reader .  
 
 


  Datasheet File OCR Text:
  communication processor module motorola mpc823 reference manual 16-379 smc communication 16 processor module the expected results are as follows: ? the tx buffer descriptor (ep0) control/status field must contain 0x3800. ? the tx buffer descriptor (ep0) data length field must contain 0x0003. ? the tx buffer descriptor (ep1) control/status field must contain 0x3c80. ? the tx buffer descriptor (ep1) data length field must contain 0x0003. ? the rx buffer descriptor (ep0) control/status field must contain 0x3c00. ? the rx buffer descriptor (ep0) data length field must contain 0x0005. ? the rx buffer descriptor (ep0) data buffer field must contain 0xabcd122b, 0x42xxxxxx. 16.11 the serial management controllers the serial management controllers (smcs) consist of two full-duplex ports that can be independently configured to support any one of three protocols or modesuart, transparent, or general-circuit interface (gci). simple uart operation is used to provide a debug/monitor port in an application, which allows a serial communication controller (sccx) to be free for other purposes. the serial management controller clock can be derived from one of the four internal baud rate generators or from a 16 external clock pin. the functionality and performance provided by the smcx in uart mode is generally less than that provided by an sccx in uart mode. the smcx implementation does not support such features as special character recognition and detection. in totally transparent mode, a serial management controller can use the tdm channel to connect to a t1 line or directly to the smcs set of pins. however, smc2 does not have its own set of dedicated pins, so the time-slot assigner pins are its only option. the receive and transmit clocks are derived from the time-division multiplex (tdm) channel, the internal baud rate generators, or from an external 1 clock. the transparent protocol allows the transmitter and receiver to use the external synchronization pin.
communication processor module 16-380 mpc823 reference manual motorola smc communication 16 processor module each serial management controller supports the circuit interface and monitor channels of the gci bus. in which case, the serial management controller is connected to the tdm channel in the serial interface. for testing purposes, the serial management controllers support loopback and echo modes. the smcx receiver and transmitter are double-buffered, which provides an effective fifo size (latency) of two characters. refer to section 16.7 the serial interface with time-slot assigner for details about configuring the gci interfaces. the receive data source for the two serial management controller channels have different pin options for each channel. smc1 can either use the l1rxda pin of the serial interface or the smrxd1 pin if it is connected to the nmsi. smc2 can also use the l1rxda pin of the serial interface, but if you use the smrxd2 pin the serial interface time-slot assigner function is not available. likewise, the transmit data source for smc1 can be the l1txda pin if a serial management controller is connected to the tdm or the smtxd1 pin if it is connected to the nmsi. smc2 transmit data source can also be l1txda pin if the serial management controller is connected to the tdm, but if you use the smtxd2 pin, the serial interface time-slot assigner function is not available. if the serial management controllers are connected to the tdm, the smcx receive and transmit clocks can be independent from each other, as defined in the crta bit of the simode register. refer to section 16.7.5.2 serial interface mode register for more information. however, if a serial management controller is connected to the nmsi, the smcx receive and transmit clocks must be connected to a single clock source called smclk, which is an internal signal name for a clock that is generated from the bank of clocks. smclk originates from an external pin or one of the two internal baud rate generators. refer to section 16.7.8 nonmultiplexed serial interface configuration for more details. figure 16-113. serial management controller block diagram control registers u-bus rx data register tx data register shifter shifter control logic peripheral bus txdx rxdx sync clock
communication processor module motorola mpc823 reference manual 16-381 smc communication 16 processor module if the serial management controllers are connected to the tdm, it gets its synchronization pulse from the time-slot assigner. otherwise, if a serial management controller is connected to the nmsi and the transparent protocol is selected, the serial management controller can use the smsynx pin as a synchronization pin to determine when it must start transmitting and receiving. the smsynx pin is not used, however, when a serial communication controller is in uart mode. 16.11.1 features the following is a list of the serial management controllers main features: ? each serial management controller can implement the uart protocol on its own pins ? each serial management controller can implement a totally transparent protocol on a multiplexed or nonmultiplexed line. if smc2 uses a nonmultiplexed line, the serial interface time-slot assigner is not available. ? each smcx channel fully supports the circuit interface and monitor channels of the gci (iom-2) in isdn applications ? two serial management controllers support the two sets of circuit interface and monitor channels in the scit channels 0 and 1 ? full-duplex operation ? local loopback and echo capability for testing 16.11.2 general smcx mode register the operating mode of each serial management controller port is defined by the 16-bit, memory-mapped, read/write general smcx mode register (smcmr). refer to each specific smcx protocol section for information about this register and table 16-2 (page 16-11) for specific commands. 16.11.3 smcx buffer descriptor operation when the serial management controllers are configured to operate in gci mode, their memory structure is predefined as one half-word long for transmit and one half-word long for receive. for more information on these half-word structures, refer to section 16.11.8 the smcx in gci mode .
communication processor module 16-382 mpc823 reference manual motorola smc communication 16 processor module in uart and transparent modes, the serial management controllers have a memory structure that is similar to the serial communication controllers. each buffer is referenced by a buffer descriptor and organized in a buffer descriptor ring located in the dual-port ram, as illustrated in figure 16-114. the buffer descriptor ring allows you to define buffers for transmission and reception and each ring forms a circular queue. using the buffer descriptors, the communication processor module confirms reception and transmission so that the microprocessor knows the buffers have been serviced. the data buffers can reside in external or internal memory and the data buffers reside in the parameter area of an sccx or smcx if that channel is not enabled. 16.11.4 smc general parameter ram memory map each smcx parameter ram area begins at the same offset from each base. the protocol-specific portions of the smcx parameter ram are discussed in each mode. the smcx general parameter ram shared by the uart and transparent protocols is described in table 16-36. the gci protocol has its own parameter ram. you must initialize certain parameter ram values before a serial management controller is enabled. other values are initialized or written by the communication processor module. once initialized, most parameter ram values do not need to be accessed in your software since most of the activity is centered around the transmit and receive buffer descriptors and not the parameter ram. however, if you access the parameter ram, note the following restrictions. figure 16-114. smcx memory format frame status data pointer frame status data length data pointer pointer to smcx tx bd ring rx data buffer dual- port ram external memory tx bd ring rx bd ring tx data buffer pointer to smcx rx bd ring smcx tx bd ring smcx rx bd ring data length
communication processor module motorola mpc823 reference manual 16-383 smc communication 16 processor module ? the parameter ram values that pertain to the smcx transmitter can only be written when the ten bit in the smcmr is zero or after the stop transmit command is issued, but before the restart transmit command is issued. ? the parameter ram values that pertain to the smcx receiver can only be written when: o the ren bit in the smcmr is zero. o the receiver is previously enabled after the enter hunt mode command is issued. o the close rx bd command is issued before the ren bit is set. table 16-36. smcx (uart and transparent) parameter ram memory map address name width description smcx base + 00 rbase half-word rx buffer descriptor base address smcx base + 02 tbase half-word tx buffer descriptor base address smcx base + 04 rfcr byte rx function code smcx base + 05 tfcr byte tx function code smcx base + 06 mrblr half-word maximum receive buffer length smcx base + 08 rstate word rx internal state smcx base + 0c rptr word rx internal data pointer smcx base + 10 rbptr half-word rx buffer descriptor pointer smcx base + 12 rcnt half-word rx internal byte count smcx base + 14 rtmp word rx temp smcx base + 18 tstate word tx internal state smcx base + 1c tptr word tx internal data pointer smcx base + 20 tbptr half-word tx buffer descriptor pointer smcx base + 22 tcnt half-word tx internal byte count smcx base + 24 ttmp word tx temp smcx base + 28 first word of protocol-specific area smcx base + 36 last word of protocol-specific area note: you are only responsible for initializing the items in bold. smcx base = (immr & 0xffff0000) + 0x3e80 (smc1) and 0x3f80 (smc2).
communication processor module 16-384 mpc823 reference manual motorola smc communication 16 processor module ? rbase and tbasethese entries are used by the dual-port ram starts the smcx receive and transmit buffer descriptors. they provide a great deal of flexibility for partitioning the buffer descriptors for a serial management controller. by selecting rbase and tbase entries for a serial management controller and by setting the w bit in the last buffer descriptor in each buffer descriptor list, you can select the number of buffer descriptors to allocate for the transmit and receive side of the serial management controller. however, you must initialize these entries before enabling the corresponding channel. furthermore, you must not configure buffer descriptor tables of two enabled serial management controllers to overlap or erratic operation will occur. ? rfcr and tfcrthere are separate function code registers for the two smcx channels. one for receive data buffers (rfcr) and one for transmit data buffers (tfcr). the function code entry contains the value that you want to appear on the at pins when the associated sdma channel accesses memory. it also controls the byte-ordering convention that is used in the transfers. bits 0C2reserved these bits are reserved and must be set to 0. bobyte ordering set these bits to select the required byte ordering of the data buffer. if this field is modified on-the-fly, it takes effect at the beginning of the next frame or the next buffer descriptor. 00 = the dec/intel convention is used for byte ordering (swapped operation) and is also called little-endian byte ordering. the transmission order of bytes within a buffer word is reversed in comparison to the motorola mode. this mode is supported only for 32-bit port size memory. note: rbase and tbase must contain a value that is divisible by eight. rfcr bit 0 1 2 3 4 5 6 7 field reserved bo at1-at3 reset 000 r/w r/w r/w r/w addr smc1 and smc2 base + 0x04
communication processor module motorola mpc823 reference manual 16-385 smc communication 16 processor module 01 = powerpc little-endian byte ordering. as data is transmitted onto the serial line from the data buffer, the least-significant byte of the buffer double-word contains data to be transmitted earlier than the most-significant byte of the same buffer double-word. 1x = motorola byte ordering (normal operation) is also called big-endian byte ordering. as data is transmitted onto the serial line from the data buffer, the most-significant byte of the buffer word contains data to be transmitted earlier than the least-significant byte of the same buffer word. ataddress type 1C3 these bits contain the function code value used during the sdma channel memory access. the at0 pin is driven with a 1 to identify this sdma channel access as a dma type. bits 0C2reserved these bits are reserved and must be set to 0. bobyte ordering set these bits to select the required byte ordering of the data buffer. if this field is modified on-the-fly, it takes effect at the beginning of the next frame or the next buffer descriptor. 00 = the dec/intel convention is used for byte ordering (swapped operation) and is also called little-endian byte ordering. the transmission order of bytes within a buffer word is reversed in comparison to the motorola mode. this mode is supported only for 32-bit port size memory. 01 = powerpc little-endian byte ordering. as data is transmitted onto the serial line from the data buffer, the least-significant byte of the buffer double-word contains data to be transmitted earlier than the most-significant byte of the same buffer double-word. 1x = motorola byte ordering (normal operation) is also called big-endian byte ordering. as data is transmitted onto the serial line from the data buffer, the most-significant byte of the buffer word contains data to be transmitted earlier than the least-significant byte of the same buffer word. tfcr bit 0 1 2 3 4 5 6 7 field reserved bo at1Cat3 reset 000 r/w r/w r/w r/w addr smc1 and smc2 base + 0x05
communication processor module 16-386 mpc823 reference manual motorola smc communication 16 processor module ataddress type 1C3 these bits contain the function code value used during this sdma channel memory access. the at0 pin is driven with a 1 to identify this sdma channel access as a dma type. ? mrblreach serial management controller has one maximum receive buffer length register that defines the length of the receive buffer. the mrblr defines the maximum number of bytes that the mpc823 writes to a receive buffer on a serial management controller before it moves on to the next buffer. the mpc823 can write fewer bytes to the buffer than mrblr if a condition, such as an error or end-of-frame occurs, but it never writes more bytes than the mrblr value. it follows then, that the buffers you supply must always be at least as long as the mrblr. the transmit buffers for a serial management controller are not affected in any way by the value programmed into the mrblr. each transmit buffer can have a different length. you can choose the number of bytes to be transmitted by programming the data length field in the tx buffer descriptor. ? rbptrthe receiver buffer descriptor pointer for each smcx channel points to the next buffer descriptor the receiver transfers data to when it is idle or to the current buffer descriptor during frame processing. after a reset or when the end of the buffer descriptor table is reached, the communication processor module initializes this pointer to the value programmed in the rbase entry. although you will not usually need to write the rbptr in most applications, you can modify it when the receiver is disabled or when you are sure no receive buffer is currently being used. ? tbptrthe transmitter buffer descriptor pointer for each smcx channel points to the next buffer descriptor the transmitter transfers data from when it is idle or to the current buffer descriptor during frame transmission. after a reset or when the end of the buffer descriptor table is reached, the communication processor module initializes this pointer to the value programmed in the tbase register. although you will not usually need to write tbptr in most applications, you can modify it when the receiver is disabled or when you are sure no receive buffer is currently being used. note: the mrblr is not intended to be dynamically changed while a serial management controller is operating. however, if it is modified in a single bus cycle with one 16-bit move (not two 8-bit bus cycles back-to-back), then a dynamic change in the receive buffer length can be successfully achieved. this occurs when the communication processor module transfers control to the next rx buffer descriptor in the table. thus, a change to mrblr does not have an immediate effect. to guarantee that the change occurs on a particular rx buffer descriptor, you must only change the mrblr while the smcx receiver is disabled. the value of mrblr must be greater than zero and it must be even if the character length of the data is greater than 8 bits.
communication processor module motorola mpc823 reference manual 16-387 smc communication 16 processor module ? other general parametersyou do not need to access these parameters during normal operation. they are only listed because they provide helpful debugging information. additional parameters are listed in table 16-33 (page 16-354). the rx and tx internal data pointers are updated by the sdma channels to show the next address in the buffer to be accessed. tcnt is a down-count value that is initialized with the data length field of the tx buffer descriptor and decremented with every byte read by the sdma channels. rcnt is a down-count value that is initialized with the mrblr value and decremented with every byte written by the sdma channels. rstate, tstate, rtemp, ttemp, and the reserved areas are only used by the risc microcontroller. 16.11.5 disabling the smcs on-the-fly if you do not need a serial management controller, it can be disabled and reenabled later. in which case, you must follow a particular sequence of steps to ensure that the buffers are properly closed and that new data is transferred to or from a new buffer. this sequence is required if the parameters you want to change are not dynamic. if the register or bit description states that dynamic or on-the-fly changes are allowed, you do not have to follow the sequence and the register or bit can can be changed immediately. note: to extract data from a partially full receive buffer, use the close rx bd command. note: a serial management controller does not have to be fully disabled for you to modify the parameter ram. refer to the parameter ram description for details about modifying the parameter ram values. if you want to disable the sccs, usb, smcs, spi, and i 2 c, use the cpm command register (described in section 16.2.6.1 cpm command register ) to reset the communication processor module with a single command.
communication processor module 16-388 mpc823 reference manual motorola smc communication 16 processor module 16.11.5.1 disabling the entire smcx transmitter. follow these steps to fully enable or disable the smcx transmitter: 1. issue the stop transmit command. this command is recommended when a serial management controller is transmitting data since it stops transmission smoothly. this command is not required if a serial management controller is not transmitting, if you overwrite the tbptr or if you execute the init tx parameters command. 2. clear the ten bit in the smcmr. this disables the smcx transmitter and puts it in a reset state. 3. modify the smcx transmit parameters, including the parameter ram. if you prefer to switch protocols or restore the smcx transmit parameters to their initial state, issue the init tx parameters command. 4. issue the restart transmit command. you must do this if you did not issue the init tx parameters command in step 3. 5. set the ten bit in the smcmr. when the r bit is set in the tx buffer descriptor, transmission begins using the tx buffer descriptor indicated by the tbptr value. 16.11.5.2 disabling part of the smcx transmitter. follow this shorter sequence if you prefer to reinitialize the transmit parameters to the state they were in after reset. 1. clear the ten bit in the smcmr. 2. issue the init tx parameters command and make any additional modifications. 3. set the ten bit in the smcmr. 16.11.5.3 disabling the entire smcx receiver. follow these steps to fully enable or disable the receiver: 1. clear the ren bit in the smcmr. reception is aborted immediately, which disables the smcx receiver and puts it in a reset state. 2. modify the smcx receive parameters, including the parameter ram. if you prefer to switch protocols or restore the smcx receive parameters to their initial state, issue the init rx parameters command. 3. issue the close rx bd command. you must do this if you did not issue the init rx parameters command in step 2. 4. set the ren bit in the smcmr. when the e bit is set in the rx buffer descriptor, reception begins immediately using the rx buffer descriptor indicated by the rbptr.
communication processor module motorola mpc823 reference manual 16-389 smc communication 16 processor module 16.11.5.4 disabling part of the smcx receiver. follow this shorter sequence to reinitialize the receive parameters to the state they were in after reset. 1. clear the ren bit in the smcmr. 2. init rx parameters command and make any additional modifications. 3. set the ren bit in the smcmr. 16.11.5.5 switching protocols. to switch a protocol that is being executed by a serial management controller without resetting the board or affecting any other serial management controller: 1. clear the ten and ren bits in the smcmr. 2. issue the init tx and rx params command to initialize the transmit and receive parameters. make any additional modifications in the smcmr. 3. set the ten and ren bits in the smcmr. the serial management controller is now enabled with the new protocol. 16.11.6 the smcx in uart mode compared to an sccx in uart mode, the serial management controllers are designed to support simple debug/monitor ports instead of full-featured uart controllers. the following is a list of the features that the smcx in uart mode does not support. ? rtsx , ctsx , and cdx pins ? receive and transmit sections clocked at different rates ? fractional stop bits ? built-in multidrop modes ? freeze mode for implementing flow control ? isochronous operation (1 clock ) ? interrupts on special control character reception ? ability to transmit data on demand using the transmit on demand register tip: you can save power by clearing the ten and ren bits of a serial management controller.
communication processor module 16-390 mpc823 reference manual motorola smc communication 16 processor module a serial management controller in uart mode has one feature that an sccx in uart mode does not. data length on an smcx can be a maximum of 14 bits, whereas, a serial communication controller only allows 8 bits. a serial management controller in uart mode is also referred to as a smcx uart controller. 16.11.6.1 features. the following list summarizes the main features of the smcx in uart mode: ? flexible message-oriented data structure ? programmable data length (5C14 bits) ? programmable 1 or 2 stop bits ? even/odd/no parity generation and checking ? frame error, break, and idle detection ? transmit preamble and break sequences ? received break character length indication ? continuous receive and transmit modes 16.11.6.2 smcx uart channel transmission process. the uart transmitter is designed to work with almost no intervention from the core. when the core enables the smcx transmitter, it starts transmitting idles. the smcx uart controller immediately polls the first buffer descriptor in the transmit channel buffer descriptor ring and once every character time after that, depending on the character length. when there is a message to transmit, the smcx uart controller fetches the data from memory and starts transmitting the message. figure 16-115. smcx uart frame format smtxd smclk 16 start bit 5 to 14 data bits with the least-significant bit first par. bit optional 1 or 2 stop bits ( clock not to scale )
communication processor module motorola mpc823 reference manual 16-391 smc communication 16 processor module when the buffer descriptor data is completely written to the transmit fifo, the smcx uart controller writes the message status bits into the buffer descriptor and clears the r bit. an interrupt is issued if the i bit in the buffer descriptor is set. if the next tx buffer descriptor is ready, the data from its data buffer is appended to the previous data and transmitted out on the transmit pin, without any gaps between the buffers. if the next tx buffer descriptor is not ready, the smcx uart controller starts transmitting idles and waits for the next tx buffer descriptor to be ready. by appropriately setting the i bit in each buffer descriptor, interrupts can be generated after the transmission of each buffer, a specific buffer, or each block. the smcx uart controller then proceeds to the next buffer descriptor in the table. if the cm bit is set in the tx buffer descriptor, the r bit is not cleared, allowing the associated data buffer to be automatically retransmitted next time the communication processor module accesses this data buffer. for instance, if a single tx buffer descriptor is initialized with the cm and w bits set, the data buffer is continuously transmitted until you clear the r bit of the buffer descriptor. 16.11.6.3 smcx uart channel reception process. when the core enables the smcx receiver in uart mode, it enters hunt mode and waits for the first character to arrive. once the first character arrives, the communication processor module checks the first receive buffer descriptor to see if it is empty and then starts storing characters in the associated data buffer. when the data buffer is filled or the max_idl timer expires (if it is enabled) the smcx uart controller clears the e bit in the buffer descriptor and generates an interrupt if the i bit in the buffer descriptor is set. if the incoming data exceeds the length of the data buffer, the smcx uart controller fetches the next buffer descriptor in the table and, if it is empty, continues transferring data to the associated data buffer. if the cm bit is set in the receive buffer descriptor, the e bit is not cleared, which allows the associated data buffer to be automatically overwritten next time the communication processor module accesses this data buffer. 16.11.6.4 smcx uart parameter ram memory map. when a serial management controller is configured to operate in uart mode, the smcx uart controller overlays the structure used in table 16-36 with the parameters described in table 16-37. table 16-37. smcx uart parameter ram memory map address name width description smcx base + 28 max_idl half-word maximum idle characters smcx base + 2a idlc half-word temporary idle counter smcx base + 2c brkln half-word last received break length smcx base + 2e brkec half-word receive break condition counter smcx base +30 brkcr half-word break count register (transmit) smcx base +32 r_mask half-word temporary bit mask note: you are only responsible for initializing the items in bold. smcx base = (immr & 0xffff0000) + 0x3e80 (smc1) and 0x3f80 (smc2).
communication processor module 16-392 mpc823 reference manual motorola smc communication 16 processor module ? max_idlonce a character of data is received on the line, the smcx uart controller starts counting any idle characters received. if a max_idl number of idle characters is received before the next data character, an idle timeout occurs and the buffer closes. this, in turn, produces an interrupt request to the core to receive the data from the buffer. max_idl provides a convenient way to demarcate frames in smcx uart mode. but if you do not want to use max_idl, you must program max_idl to 0x0000 and the buffer will never close, regardless of the number of idle characters received. the number of bits in an idle character is calculated as follows1 + character data length (5 to 14) + 1 (if parity bit is used) + number of stop bits (1 or 2). for example, for a character data length of 8, no parity, and 1 stop bit, the idle character length is 10 bits. ? idlcthis value is used by the risc microcontroller to store the current idle counter value in the max_idl timeout process. idlc is a down-counter that you do not need to initialize or access. ? brklnthis value is used to store the length of the last break character received and is the bit length of that character. for example, if the receive pin is low for 257 bit times, brkln shows the value 0x0101 and its accuracy comes within one character unit of bits. for 8 data bits, no parity, 1 stop bit, and 1 start bit, brkln is accurate within 10 bits. ? brkecthis counter counts the number of break conditions that occur on the line. one break condition can last for hundreds of bit times, yet this counter is only incremented once during that period. ? brkcrthis value indicates when the smcx uart controller sends a break character sequence after a stop transmit command is issued. the number of break characters sent by the smcx uart controller is determined by the value in brkcr. for 8 data bits, no parity, 1 stop bit, and 1 start bit, each break character is 10 bits long and consists of all zeros. ? r_maskthis value is a temporary bit mask used internally by the smcx uart controller. 16.11.6.5 programming the smcx uart controller. the smcx uart controllers data structure supports multibuffer operation and allows you to transmit break and preamble sequences. overrun, parity, and framing errors are reported via the buffer descriptors. in its simplest form, the smcx uart controller functions in a character-oriented environment. each character is transmitted with the stop bits and parity that you configure. characters are received into separate 1-byte buffers. a maskable interrupt can be generated when each buffer is filled. many applications may want to take advantage of the message-oriented capabilities that the smcx uart controller supports through linked buffers for reception or transmission. you can handle data in a message-oriented environment and work on entire messages rather than on a character-by-character basis. a message can span several linked buffers and each one can be transmitted and received as a linked list of buffers without any intervention from the core, which makes it easy to program and saves processor overhead. in a message-oriented environment, the idle sequence is used as the message delimiter. the transmitter can generate an idle sequence before starting a new message and the receiver can close a buffer when an idle sequence is found.
communication processor module motorola mpc823 reference manual 16-393 smc communication 16 processor module 16.11.6.6 smcx uart commands. you can program the cpm command register (cpcr) with the following commands to transmit data. ? stop transmit this command disables the transmission of characters on the transmit channel. if the smcx uart controller receives this command while transmitting a message, it stops transmitting. the smcx uart controller finishes transmitting any data that has already been transferred to its fifo and shift register and then stops transmitting data. the tbptr is not advanced when this command is issued. the smcx uart controller transmits a programmable number of break sequences and then transmits idles. the number of break sequences, which can be zero, must be written to the brkcr entry before this command is issued to the smcx uart controller. ? restart transmit this command enables characters to be transmitted on the transmit channel. the smcx uart controller expects it after disabling the channel in its smcmr and after issuing the stop transmit command. the smcx uart controller resumes transmission from the current tbptr in the channels transmit buffer descriptor table. ? init tx parameters this command initializes all the transmit parameters in this serial channels parameter ram to their reset state and must only be issued when the transmitter is disabled. the init tx and rx params command can also be used to reset the transmit and receive parameters. you can program the cpcr with the following commands to receive data. ? enter hunt mode this command cannot be used for an smcx uart channel. issue the close rx bd command instead. ? close rx bd this command is used to force a serial management controller to close the current receive buffer descriptor if it is currently being used and to use the next buffer descriptor in the list for any subsequently received data. if a serial management controller is not in the process of receiving data, no action is taken by this command. ? init rx parameters this command initializes all the receive parameters in this serial channel parameter ram to their reset state. this command must only be issued when the receiver is disabled. the init tx and rx params command can also be used to reset the receive and transmit parameters. 16.11.6.7 sending a break. a break is an all-zeros character without stop bits and it is sent by issuing the stop transmit command. the smcx uart controller finishes transmitting any outstanding data and then sends a character with consecutive zeros. the number of zero bits in this character is the sum of the character length, plus the number of start, parity, and stop bits. the smcx uart controller transmits a programmable number of break characters according to the brkcr entry and then reverts to idle or sends data if the restart transmit command was issued before completion. when the break is completed, the transmitter sends at least one idle character before transmitting any data to guarantee recognition of a valid start bit.
communication processor module 16-394 mpc823 reference manual motorola smc communication 16 processor module 16.11.6.8 sending a preamble. a preamble sequence provides a convenient way for you to ensure that the line is idle before you start a new message. the preamble sequence is constructed of consecutive ones that are one character long. if the preamble bit in a buffer descriptor is set, a serial management controller sends a preamble sequence before transmitting that data buffer. for 8 data bits, no parity, 1 stop bit, and 1 start bit, a preamble of 10 ones would be sent before the first character in the buffer. if no preamble sequence is sent, data from two ready transmit buffers can be transmitted without causing a delay on the transmit pin between the two transmit buffers. 16.11.6.9 smcx uart controller errors. the smcx uart controller reports character reception error conditions via the channel buffer descriptors and the smcx uart event register. the smcx uart controller has no transmission errors, which means you cannot stop the transmission of characters in smcx uart mode. ? overrun error the smcx uart controller maintains a two-character length fifo for receiving data. the data is moved to the buffer after the first character is received into the fifo and if a receiver fifo overrun occurs, the channel writes the received character into the internal fifo. then the channel writes the received character to the buffer, closes it, sets the ov bit in the receive buffer descriptor, and generates a receive interrupt if it is enabled. reception then continues as normal. ? parity error when this error occurs, the channel writes the received character to the buffer, closes it, sets the pr bit in the buffer descriptor, and generates the receive interrupt if it is enabled. reception then continues as normal. ? idle sequence receive erroran idle is detected when one character consisting of all ones is received. once an idle is received, the channel counts the number of consecutive idle characters. if the count reaches the max_idl value, the buffer is closed, and an receive interrupt is generated. if no receive buffer is open, this event does not generate an interrupt or any status information. the idle counter is reset every time a character is received. ? framing error the smcx uart controller receives this error when it receives a character with no stop bit. when this error occurs, the channel writes the received character to the buffer, closes the buffer, sets the fr bit in the buffer descriptor, and generates the receive interrupt if it is enabled. when this error occurs, parity is not checked for the character. ? break sequence errorthis error occurs when the smcx uart receiver receives an all-zero character with a framing error. when it occurs, the channel increments the brkec entry and generates a maskable brk interrupt in the smceCuart register. the channel also measures the length of the break sequence and stores this value in the brkln counter. if the channel was in the middle of buffer processing when the break was received, the buffer is closed with the br bit in the receive buffer descriptor set and the receive interrupt is generated if it is enabled. note: the smcx uart controller may occasionally get an overrun error when the line is idle, in which case, ignore the error.
communication processor module motorola mpc823 reference manual 16-395 smc communication 16 processor module 16.11.6.10 smcx uart mode register. when a serial management controller is in uart mode, the 16-bit, memory-mapped, read/write smcx mode register is referred to as the smcx uart mode register (smcmrCuart). the functionality of bits 8-15 is common to each smcx protocol, but bits 0-7 vary according to the protocol selected by the sm field. this register is cleared by reset. bits 0 and 8C9reserved these bits are reserved and must be set to 0. clencharacter length this field must be programmed with the total number of bits in the character minus one. the total number of bits in the character is calculated as the sum of 1 (start bit always present) + number of data bits (5 to 14) + number of parity bits (0 or 1) + number of stop bits (1 or 2). for example, for 8 data bits, no parity, and 1 stop bit, the total number of bits in the character is 1 + 8 + 0 + 1 = 10. in this case, clen must be programmed to 9. the number of data bits in the character ranges from 5 to 14 bits. if the data bit length is less than 8 bits, the most-significant bits of each byte in memory are not used on transmission and are written with zeros on reception. on the other hand, if the data bit length is more than 8 bits, the most-significant bits of each 16-bit word in memory are not used on transmit and are written with zeros on receive. slstop length 0 = one stop bit. 1 = two stop bits. penparity enable 0 = no parity. 1 = parity is enabled for the transmitter and receiver, depending on the pm bit setting. smcmrCuart bit 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 field res clen sl pen pm res sm dm ten ren reset 0 0 000 0 0 0 00 r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w addr (immr & 0xffff0000) + 0xa82 (smc1), 0xa92 (smc2) note: the total number of bits in the character must never exceed 16. thus, if you choose a 14-bit data length, set sl to one stop bit and disable parity. if you choose a 13-bit data length and parity is enabled, set sl to one stop bit. to prevent erratic behavior, do not write the values 0-3 to clen.
communication processor module 16-396 mpc823 reference manual motorola smc communication 16 processor module pmparity mode 0 = odd parity. 1 = even parity. smsmcx mode 00 = gci or scit support. 01 = reserved. 10 = uart mode (must be selected for smcx uart operation). 11 = totally transparent mode. dmdiagnostic mode 00 = normal mode. 01 = local loopback mode. 10 = echo mode. 11 = reserved. tensmcx transmit enable 0 = smcx transmitter disabled. 1 = smcx transmitter enabled. rensmcx receive enable 0 = smcx receiver disabled. 1 = smcx receiver enabled. 16.11.6.11 smcx uart receive buffer descriptor. using the buffer descriptors, the communication processor module reports information about the received data on a per-buffer basis. it then closes the current buffer, generates a maskable interrupt, and starts receiving data into the next buffer when one of the following events occurs: ? an error is received while a message is being processed. ? a full receive (rx) buffer is detected. ? a programmable number of consecutive idle characters are received. note: the communication processor module sets all the status bits in this buffer descriptor, but you must clear them before submitting the buffer descriptor to the communication processor module. 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 offset + 0 e res wi reserved cm id reserved br fr pr res ov res offset + 2 data length offset + 4 rx data buffer pointer offset + 6 note: you are only responsible for initializing the items in bold.
communication processor module motorola mpc823 reference manual 16-397 smc communication 16 processor module eempty 0 = the data buffer associated with this rx buffer descriptor is filled with received data or data reception is aborted due to an error condition. the core is free to examine or write to any fields of this rx buffer descriptor. the communication processor module does not use this buffer descriptor as long as the e bit is zero. 1 = the data buffer associated with this buffer descriptor is empty or reception is currently in progress. this rx buffer descriptor and its associated receive buffer are owned by the communication processor module. once the e bit is set, the core must not write any fields of this rx buffer descriptor. bits 1, 4C5, 8C9, 13, and 15reserved these bits are reserved and must be set to 0. wwrap (final buffer descriptor in table) 0 = this is not the last buffer descriptor in the rx buffer descriptor table. 1 = this is the last buffer descriptor in the rx buffer descriptor table. after this buffer is used, the communication processor module receives incoming data into the first buffer descriptor that rbase points to in the table. the number of rx buffer descriptors in this table is programmable and determined only by the w bit and overall space constraints of the dual-port ram. iinterrupt 0 = no interrupt is generated after this buffer is filled. 1 = the rx bit in the event register is set when this buffer is completely filled by the communication processor module, indicating the need for the core to process the buffer. the rx bit can cause an interrupt if it is enabled. cmcontinuous mode 0 = normal operation. 1 = the e bit is not cleared by the communication processor module after this buffer descriptor is closed, thus allowing the associated data buffer to be automatically overwritten next time the communication processor module accesses this buffer descriptor. however, the e bit is cleared if an error occurs during reception, regardless of how the cm bit is set. idbuffer closed on reception of idles this bit indicates that the buffer has closed because a programmable number of consecutive idle sequences have been received. the communication processor module writes this bit after the received data is in the associated data buffer. brbuffer closed on reception of break this bit indicates that the buffer has closed because a break sequence has been received. the communication processor module writes this bit after the received data is in the associated data buffer. 0 = no break sequence is received. 1 = a break sequence is received and the buffer closes.
communication processor module 16-398 mpc823 reference manual motorola smc communication 16 processor module frframing error this bit indicates that a character with a framing error has been received and is located in the last byte of this buffer. a framing error is a character without a stop bit. a new receive buffer is used to receive additional data. the communication processor module writes this bit after the received data is in the associated data buffer. prparity error this bit indicates that a character with a parity error has been received and is located in the last byte of this buffer. a new receive buffer is used to receive additional data. the communication processor module writes this bit after the received data is in the associated data buffer. ovoverrun this bit indicates that a receiver overrun has occurred during message reception. the communication processor module writes this bit after the received data is in the associated data buffer. data length this field represents the number of octets the communication processor module writes into this buffer descriptor data buffer. after the data is received in the associated data buffer, the communication processor module writes this field once the buffer descriptor closes. rx data buffer pointer this field always points to the first location of the associated data buffer and must be even. the buffer can reside in internal or external memory. the communication processor module writes this bit after the received data is in the associated data buffer. note: the actual amount of memory allocated for this buffer must be greater than or equal to the mrblr entry.
communication processor module motorola mpc823 reference manual 16-399 smc communication 16 processor module figure 16-116 illustrates an example of the rx buffer descriptor process. it shows the resulting state of the rx buffer descriptors after they receive 10 characters, an idle period, and five characters (one with a framing error). the example assumes that mrblr = 8 in the smcx parameter ram. figure 16-116. smcx uart receive buffer descriptor example mrblr = 8 bytes for this smc buffer byte 1 byte 2 byte 8 etc. 8 bytes long idle period fourth character has framing error! 5 chars 10 chars characters received by uart time buffer byte 9 byte 10 8 bytes buffer byte 1 byte 2 8 bytes byte 4 has framing error buffer full byte 3 byte 4 error! e length 32-bit buffer pointer receive bd 0 status 0008 pointer 0 e length 32-bit buffer pointer receive bd 1 status 0002 pointer 0 1 id 0 id e length 32-bit buffer pointer receive bd 2 status 0004 pointer 0 id 0 fr 1 e length 32-bit buffer pointer receive bd 3 status xxxx pointer 1 buffer byte 5 8 bytes reception still in progress with this buffer present time idle timeout occurred empty empty additional bytes will be stored unless idle count expires (max_idl)
communication processor module 16-400 mpc823 reference manual motorola smc communication 16 processor module 16.11.6.12 smcx uart transmit buffer descriptor. data is sent to the communication processor module for transmission on an smcx channel by arranging it in buffers referenced by the channels transmit (tx) buffer descriptor ring. using the buffer descriptors, the communication processor module confirms transmission or indicates error conditions so that the processor knows the buffers have been serviced. rready 0 = the data buffer associated with this buffer descriptor is not ready for transmission, but you are free to manipulate this buffer descriptor or its associated data buffer. the communication processor module clears this bit after the buffer has been transmitted or an error condition is encountered. 1 = the data buffer, which you prepare for transmission, is not transmitted yet or is currently being transmitted. you cannot write any fields of this buffer descriptor once this bit is set. bits 1, 4C5, and 8C15reserved these bits are reserved and must be set to 0. wwrap (final buffer descriptor in table) 0 = this is not the last buffer descriptor in the tx buffer descriptor table. 1 = this is the last buffer descriptor in the tx buffer descriptor table. after this buffer is used, the communication processor module receives incoming data into the first buffer descriptor that tbase points to in the table. the number of tx buffer descriptors in this table is programmable and determined only by the w bit and overall space constraints of the dual-port ram. iinterrupt 0 = no interrupt is generated after this buffer is serviced. 1 = the tx bit in the smceCuart register is set when this buffer is serviced. transmission can cause an interrupt if it is enabled. 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 offset + 0 r res wi reserved cm p reserved offset + 2 data length offset + 4 tx data buffer pointer offset + 6 note: you are only responsible for initializing the items in bold. note: the communication processor module sets all the status bits in this buffer descriptor, but you must clear them before submitting the buffer descriptor to the communication processor module.
communication processor module motorola mpc823 reference manual 16-401 smc communication 16 processor module cmcontinuous mode 0 = normal operation. 1 = the r bit is not cleared by the communication processor module after this buffer descriptor is closed, thus allowing the associated data buffer to be automatically retransmitted next time the communication processor module accesses this buffer descriptor. ppreamble 0 = no preamble sequence is sent. 1 = the smcx uart controller sends one all-ones character before it sends the data so that the other end detects an idle line before the data is received. if this bit is set and the data length of this buffer descriptor is zero, only a preamble is sent. data length this field represents the number of octets that the communication processor module must transmit from this buffer descriptor data buffer. however, it is never modified by the communication processor module. normally, this value must be greater than zero, but it can be equal to zero with the p bit set if only a preamble is sent. if the number of data bits in the smcx uart character is greater than 8, then the data length must be even. for example, to transmit three uart characters of 8-bit data, 1 start, and 1 stop, the data length field must be initialized to 3. however, to transmit three smcx uart characters of 9-bit data, 1 start, and 1 stop, the data length field must be initialized to 6, since the three 9-bit data fields occupy three half-words in memory (the 9 least-significant bits of each half-word). tx data buffer pointer this field always points to the first location of the associated data buffer. it can be even or odd, unless the number of actual data bits in the smcx uart character is greater than 8 bits, in which this field is even. for instance, the pointer to 8-bit data, 1 start, and 1 stop characters can be even or odd, but the pointer to 9-bit data, 1 start, and 1 stop characters must be even. the buffer can reside in internal or external memory.
communication processor module 16-402 mpc823 reference manual motorola smc communication 16 processor module 16.11.6.13 smcx uart event register. when a serial management controller is in uart mode, the 8-bit memory-mapped smcx event register is referred to as the smcx uart event (smceCuart) register. it is used to generate interrupts and report events recognized by the smcx uart channel. when an event is recognized, the smcx uart controller sets the corresponding bit in this register. a bit is cleared by writing a 1 (writing a zero has no effect) and more than one bit can be cleared at a time. all unmasked bits must be cleared before the communication processor module clears the internal interrupt request. this register is cleared by reset and can be read at any time. an example of the timing of various events in the smceCuart register is illustrated in figure 16-117. bit 0, 2, and 4reserved these bits are reserved and must be set to 0. brkebreak end this bit indicates that an end of break sequence has been detected. it occurs after one idle bit is received after a break sequence. brkbreak character received this bit indicates that a break character has been received. if a very long break sequence occurs, this interrupt only occurs once after the first all-zeros character is received. bsybusy condition this bit indicates that a character has been received and discarded due to a lack of buffers. it is be set in the middle of the last stop bit of the first receive character for which there is no available buffer. reception continues when an empty buffer is provided. txtx buffer this bit indicates that a buffer has been transmitted over the smcx uart channel. it is set once the transmit data of the last character in the buffer is written to the transmit fifo. you must wait two character times to be sure that the data is completely sent over the transmit pin. smce Cuart bit 0 1 2 3 4 5 6 7 field reserved brke reserved brk reserved bsy tx rx reset 00000000 r/w r/w r/w r/w r/w r/w r/w r/w r/w addr (immr & 0xffff0000) + 0xa86 (smc1), 0xa96 (smc2)
communication processor module motorola mpc823 reference manual 16-403 smc communication 16 processor module rxreceive buffer this bit indicates that a buffer has been received and its associated rx buffer descriptor is now closed. it is set in the middle of the last stop bit of the last character that is written to the receive buffer. figure 16-117. smcx uart interrupt example line idle 10 characters characters received by smc uart time rxd line idle line idle 7 characters line idle txd rx rx tx break brk notes: 1. the first rx event assumes receive buffers are six bytes each. 2. the second rx event position is programmable based on the max_idl value. 3. the brk event occurs after the first break character is received. note: the tx event assumes all seven characters were put into a single buffer, and the tx event occurred when the seventh character was written to the smc transmit fifo. smc uart smce events characters transmitted by smc uart smc uart smce events brke
communication processor module 16-404 mpc823 reference manual motorola smc communication 16 processor module 16.11.6.14 smcx uart mask register. when a serial management controller is in uart mode, the 8-bit read/write smcx mask register is referred to as the smcx uart mask (smcmCuart) register. it has the same bit format as the smceCuart register. if a bit in this register is a 1, the corresponding interrupt in the smceCuart register is enabled. if the bit is zero, the corresponding interrupt in the smceCuart register is masked. 16.11.6.15 smc1 uart controller programming example. the following is an initialization sequence for 9,600 baud, 8 data bits, no parity, and 1 stop bit operation of an smc1 uart controller assuming a 25mhz system frequency. brg1 and smc1 are used. 1. configure the port b pins to enable smtxd1 and smrxd1. write pbpar bits 25 and 24 with ones and then pbdir and pbodr bits 25 and 24 with zeros. 2. configure the brg1. write 0x010144 to brgc1. the div16 bit is not used and the divider is 162 (decimal). the resulting brg1 clock is 16 the preferred bit rate of the smc1 uart controller. 3. connect the brg1 clock to smc1 using the serial interface. write the smc1 bit in simode with a 0 and the smc1cs field in simode register with 0x000. 4. write rbase and tbase in the smc1 parameter ram to point to the rx buffer descriptor and tx buffer descriptor in the dual-port ram. assuming one rx buffer descriptor at the beginning of dual-port ram and one tx buffer descriptor following that rx buffer descriptor, write rbase with 0x2000 and tbase with 0x2008. 5. program the cpcr to execute the init rx and tx params command. write 0x0091 to the cpcr. 6. write 0x0001 to the sdcr to initialize the sdma configuration register. 7. write 0x18 to the rfcr and tfcr for normal operation. 8. write mrblr with the maximum number of bytes per receive buffer. assume 16 bytes, so mrblr = 0x0010. 9. write max_idl with 0x0000 in the smc1 uart parameter ram to disable the max_idl functionality for this example. 10. clear brkln and brkec in the smc1 uart parameter ram for the clarity. 11. set brkcr to 0x0001, so that if a stop transmit command is issued, one break character is sent. smcmCuart bit 0 1 2 3 4 5 6 7 field reserved brke reserved brk reserved bsy tx rx reset 00000000 r/w r/w r/w r/w r/w r/w r/w r/w r/w addr (immr & 0xffff0000) + 0xa8a (smc1), 0xa94 (smc2)
communication processor module motorola mpc823 reference manual 16-405 smc communication 16 processor module 12. initialize the rx buffer descriptor. assume the rx data buffer is at 0x00001000 in main memory. write 0xb000 to rx_bd_status, 0x0000 to rx_bd_length (not required), and 0x00001000 to rx_bd_pointer. 13. initialize the tx buffer descriptor. assume the tx data buffer is at 0x00002000 in main memory and contains five 8-bit characters. then write 0xb000 to tx_bd_status, 0x0005 to tx_bd_length, and 0x00002000 to tx_bd_pointer. 14. write 0xff to the smceCuart register to clear any previous events. 15. write 0x17 to the smcmCuart register to enable all possible serial management controller interrupts. 16. write 0x00000010 to the cimr so smc1 can generate a system interrupt. the cicr must also be initialized. 17. write 0x4820 to smcmr to configure normal operation (not loopback), 8-bit characters, no parity, 1 stop bit. notice that the transmitter and receiver are not enabled yet. 18. write 0x4823 to smcmr to enable the smc1 transmitter and receiver. this additional write ensures that the ten and ren bits are enabled last. 16.11.6.16 handling interrupts in the smcx uart controller. follow these steps to handle an interrupt in a serial management controller: 1. once an interrupt occurs, read the smceCuart register to discover the cause of the interrupt. to clear the smce bits, write ones to them. 2. process the tx buffer descriptor to reuse it if the tx bit is set in the smceCuart register. extract data from the rx buffer descriptor if the rx bit is set in the smceCuart. to transmit another buffer, set the r bit in the tx buffer descriptor. 3. clear the smcx bit in the cisr. 4. execute the rfi instruction. note: after 5 bytes are transmitted, the tx buffer descriptor is closed. the receive buffer is closed after 16 bytes are received. any data received after 16 bytes causes a busy (out-of-buffers) condition since only one rx buffer descriptor is prepared.
communication processor module 16-406 mpc823 reference manual motorola smc communication 16 processor module 16.11.7 the smcx in transparent mode a serial managment controller in transparent mode is also referred to as the smcx transparent controller. the following is a list of the features that the smcx transparent controller does not support: ? independent transmit and receive clocks, unless it is connected to the tdm channel of the serial interface ? crc generation and checking ? full rtsx , ctsx , and cdx pins. instead, there is a smsyn pin for each smc. ? ability to transmit data on demand using the transmit on demand register ? receiver/transmitter in transparent mode while executing another protocol ? 4-, 8-, or 16-bit sync recognition ? internal dpll support an smcx in transparent mode has one feature that an sccx in transparent mode does not. the serial management controllers allow a data character length option of 4 to 16 bits, whereas the sccs allow 8 or 32 bits, depending on how the rfw bit is set in the gsmr_h (described in section 16.9.2 the general sccx mode registers ). 16.11.7.1 features. the following list summarizes the features of a serial management controller in transparent mode: ? flexible data buffers ? connects to the tdm bus using the time-slot assigner in the serial interface ? transmits and receives transparently on its own set of pins using a sync pin to synchronize the beginning of transmission and reception to an external event ? programmable 4-16 character length ? reverse data mode ? continuous transmission and reception modes ? four available commands 16.11.7.2 smcx transparent channel transmission process. the smcx transparent transmitter is designed to work with almost no intervention from the core. when the core enables the smcx transmitter in transparent mode, it starts transmitting idles. the serial management controllers immediately poll the first buffer descriptor in the transmit channel buffer descriptor ring once every character time, depending on the character length (every 4 to 16 serial clocks). when there is a message to transmit, a serial management controller fetches the data from memory and starts transmitting the message after synchronization is achieved.
communication processor module motorola mpc823 reference manual 16-407 smc communication 16 processor module synchronization can be achieved in two ways. first, when the transmitter is connected to the tdm channel, it can be synchronized to a time-slot. once the frame sync is received, the transmitter waits for the first bit of its time-slot to occur before it starts transmitting. data is only transmitted during the time-slots defined by the time-slot assigner. secondly, when working with its own set of pins, the transmitter starts transmitting when the smsynx signal is asserted. when buffer descriptor data is completely written to the transmit fifo, the l bit is checked and if it is set, a serial management controller writes the message status bits into the buffer descriptor and clears the r bit. it then starts transmitting idles. when the end of the current buffer descriptor is reached and the l bit is not set, only the r bit is cleared. in both cases, an interrupt is issued according to the i bit in the buffer descriptor. by appropriately setting the i bit in each buffer descriptor, interrupts can be generated after each buffer, a specific buffer, or each block is transmitted. the serial management controller then proceeds to the next buffer descriptor in the table. if no additional buffers have been presented to the serial management controller for transmission and the l bit was cleared, an underrun is detected and the serial management controller begins transmitting idles. if the cm bit is set in the transmit buffer descriptor, the r bit is not cleared, thus allowing the associated data buffer to be automatically retransmitted next time the communication processor module accesses this data buffer. for instance, if a single transmit buffer descriptor is initialized with the cm bit and the w bit set, the data buffer is continuously transmitted until you clear the r bit of the buffer descriptor. 16.11.7.3 smcx transparent channel reception process. when the core enables the smcx receiver in transparent mode, it waits for synchronization before receiving data. once synchronization is achieved, the receiver transfers incoming data into memory according to the first receive buffer descriptor in the ring. synchronization can be achieved in two ways. first, when the receiver is connected to the tdm channel, it can be synchronized to a time-slot. once the frame sync is received, the receiver waits for the first bit of its time-slot to occur before reception begins. data is only received during the time-slots defined by the time-slot assigner. secondly, when working with its own set of pins, the receiver starts receiving when the smsynx signal is asserted. when the data buffer is filled, a smcx transparent controller clears the e bit in the buffer descriptor and generates an interrupt if the i bit in the buffer descriptor is set. if the incoming data exceeds the length of the data buffer, a serial management controller fetches the next buffer descriptor in the table and, if it is empty, continues transferring data to the associated data buffer. if the cm bit is set in the receive buffer descriptor, the e bit is not cleared, thus allowing the associated data buffer to be automatically overwritten next time the communication processor module accesses this data buffer.
communication processor module 16-408 mpc823 reference manual motorola smc communication 16 processor module 16.11.7.4 using the smsyn x pin for synchronization. the smsynx pin offers a method to externally synchronize a smcx transparent channel. this method differs somewhat from the synchronization options available in the serial communication controllers and must be studied carefully. see figure 16-118 for an example. once the ren bit is set in the smcmr, the first rising edge of the smclk signal that finds the smsynx pin low causes the smcx receiver to achieve synchronization. data starts being received or latched on the same rising edge of smclk that latched smsynx . this is the first bit of data received. the receiver never loses synchronization again, regardless of the state of smsynx , until you clear the ren bit. once the ten bit is set in the smcmr, the first rising edge of the smclk signal that finds the smsynx pin low causes the smcx transmitter to achieve synchronization. the smcx transmitter begins transmitting ones asynchronously from the falling edge of smsynx . after one character of ones is transmitted, if the transmit fifo is loaded (the transmit buffer descriptor is ready with data), data starts being transmitted on the next falling edge of smclk after some multiple of all-ones (preamble) characters are transmitted. if the transmit fifo is loaded at some later time, the data starts transmitting after some multiple number of all-ones characters is transmitted. the transmitter never loses synchronization again, regardless of the state of smsynx , until you clear the ten bit or issue the enter hunt mode command. note: regardless of whether the transmitter or receiver uses the smsynx signal, it must make glitch-free transitions from high to low or low to high. glitches on smsynx can cause a serial management controller to behave erratically.
communication processor module motorola mpc823 reference manual 16-409 smc communication 16 processor module if both the ren and ten bits are set in the smcmr, the first falling edge of the smsynx pin causes both the transmitter and receiver to achieve synchronization. to resynchronize the transmitter or receiver, the smcx transmitter/receiver can be disabled and reenabled and the smsynx pin can be used again to resynchronize the transmitter or receiver. refer to section 16.11.5 disabling the smcs on-the-fly for a description of how to safely disable and reenable a serial management controller. simply clearing and setting the ten bit may not be sufficient. figure 16-118. smsynx pin synchronization smrxd smc1 receive data smtxd smsynx smclk ten set here tx fifo loaded appx. here smsynx detected low here smclk smsynx ren set here or enter hunt mode command issued first bit of receive data (lsb) 1s are sent smsynx detected low here smc1 transmit data first bit of first 5-bit transmit character (lsb) notes: 1. smclk is an internal clock derived from an external clock pin or a baud rate generator. 2. this example shows the smc receiver and transmitter enabled separately. if the ren and ten bits were set at the same time, a single falling edge of smsynx would synchronize both. five 1s assume character length equals 5 transmission could begin here if tx fifo not loaded in time five 1s are sent
communication processor module 16-410 mpc823 reference manual motorola smc communication 16 processor module 16.11.7.5 using the time-slot assigner for synchronization. the time-slot assigner offers a method to internally synchronize a smcx transparent channel without using the smsynx pin. this method is similar to that of the smsynx pin, except that the synchronization event is not the falling edge of the smsynx signal, but the first time-slot for this smcx receiver/transmitter after the frame sync indication. refer to section 16.7 the serial interface with time-slot assigner for further information about configuring time-slots for the smcs and sccs. the time-slot assigner allows the smcx receiver and transmitter to be enabled simultaneously and synchronized, a capability that the smsynx pin does not provide. refer to figure 16-119 for an example of synchronization using the time-slot assigner. figure 16-119. time-slot assigner synchronization tdm rx smc1 smc1 tdm tx smc1 tdm txsync tdm tx clock smc1 tdm rx sync tdm rx clock after ten is set, transmission begins here if smc runs out of tx buffers and new ones are provided later, transmission begins at the beginning of either time-slot after ren is set or after enter hunt mode command, reception begins here
communication processor module motorola mpc823 reference manual 16-411 smc communication 16 processor module once the ren bit is set in the smcmr, the first time-slot after frame sync causes the smcx receiver to achieve synchronization. data is received immediately, but only during the defined receive time-slots. the receiver continues receiving data during its defined time-slots until you clear the ren bit. if the enter hunt mode command is issued, the receiver loses synchronization, closes the current buffer, and resynchronizes to the first time-slot after the frame sync. once the ten bit is set in the smcmr, an smcx transparent controller waits for the transmit fifo to be loaded before trying to achieve synchronization. once the transmit fifo is loaded, synchronization and transmission begins, depending on the following situations: ? if a buffer is made ready when an smcx transparent controller is enabled, then the first byte will be placed in time-slot 1 if the clen field in smcmr is set to 8 and slot 2 if clen is set to 16. ? if a buffer has an smcx transparent controller enabled, then the first byte in the next buffer can appear in any time-slot associated with this channel. ? if a buffer is ended with the l bit set, then the next buffer can appear in any time-slot associated with this channel. if an smcx transparent controller runs out of transmit buffers and a new transmit buffer is provided later, idles are transmitted during the gap between data buffers. data transmission from the later data buffer begins at the beginning of an smcx transparent controller time-slot, but not necessarily the first time-slot after the frame sync. so if you want to maintain a certain bit alignment beginning with the first time-slot, make sure that at least one tx buffer descriptor is always ready and that no underrun occurs. otherwise, the smcx transparent transmitter must be disabled and reenabled. refer to section 16.11.5 disabling the smcs on-the-fly for a description of how to safely disable and reenable the smcx transparent controller. simply clearing and setting ten may not be sufficient.
communication processor module 16-412 mpc823 reference manual motorola smc communication 16 processor module 16.11.7.6 smcx transparent controller parameter ram memory map. there is no protocol-specific parameter ram for the smcx transparent controller. only the general smcx parameter ram is used. see section 16.11.4 smc general parameter ram memory map for more information. 16.11.7.7 smcx transparent commands. you can program the cpcr (described in section 16.2.6.1 cpm command register ) with the following commands to transmit data. ? stop transmit after the hardware or software is reset and the channel is enabled in the smcmCtransparent register, the channel is in transmit enable mode and starts polling the first buffer descriptor in the table. this command disables the transmission of frames on the transmit channel. if the transparent controller receives this command while transmitting a frame, it stops after the contents of the fifo are transmitted (up to 2 characters). the tbptr is not advanced to the next buffer descriptor, no new buffer descriptor is accessed, and no new buffers are transmitted for this channel. the transmitter sends idles until the restart transmit command is issued. ? restart transmit this command is used to begin or continue transmission from the current tbptr in the channels tx buffer descriptor table. when the channel receives this command, it starts polling the r bit in the tx buffer descriptor. a serial management controller expects this command after a stop transmit command is issued and the channel in the smcmr is disabled or after a transmitter error occurs. ? init tx parameters this command initializes all the transmit parameters in this serial channel parameter ram to their reset state and must only be issued when the transmitter is disabled. the init tx and rx params command can also be used to reset the transmit and receive parameters. you can program the cpcr with the following commands to receive data. ? enter hunt mode this command forces a serial management controller to close the current receive buffer descriptor if it is currently being used and to use the next buffer descriptor in the list for any subsequently received data. if a serial management controller is not in the process of receiving data, the buffer is not closed. additionally, this command causes the receiver to wait for a resynchronization before further reception continues. ? close rx bd this command is used to force a serial management controller to close the current receive buffer descriptor if it is being used and to use the next buffer descriptor in the list for any subsequently received data. if a serial management controller is not in the process of receiving data, no action is taken by this command. ? init rx parameters this command initializes all the receive parameters in this serial channels parameter ram to their reset state. it must only be issued when the receiver is disabled. the init tx and rx params command can also be used to reset the receive and transmit parameters.
communication processor module motorola mpc823 reference manual 16-413 smc communication 16 processor module 16.11.7.8 smcx transparent controller errors. the serial management controllers report message reception and transmission error conditions using the channel buffer descriptors and the smceCtransparent register. the following transmission errors can be detected by the smcx transparent controller. ? underrun error when this error occurs, the channel stops transmitting the buffer, closes it, sets the un bit in the buffer descriptor, sets the txe bit in the event register and causes an interrupt if the txe bit is set in the mask register. the channel resumes transmission after it receives the restart transmit command. underrun cannot occur between frames. ? overrun error a serial management controller maintains an internal fifo for receiving data. the communication processor module begins programming the sdma channel if the data buffer is in external memory when the first character is received into the fifo. if a fifo overrun occurs, a serial management controller writes the received data character to the internal fifo over the previously received character. the previous character and its status bits are lost. then the channel closes the buffer, sets the ov bit in the receive buffer descriptor, and generates the receive interrupt if it is enabled. reception then continues as normal. 16.11.7.9 smcx transparent mode register. when a serial management controller is in transparent mode, the 16-bit, memory-mapped, read/write smcx mode register is referred to as the smcx transparent mode register (smcmrCtransparent). the function of bits 8-15 is common to each smcx protocol, but bits 0-7 vary according to the protocol selected by the sm bits of this register. bits 0, 5, and 8C9reserved these bits are reserved and must be set to 0. smcmrCtransparent bit 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 field res clen res bs revd reserved sm dm ten ren reset 0 0 000 0 0 0 00 r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w addr (immr & 0xffff0000) + 0xa82 (smc1), 0xa92 (smc2)
communication processor module 16-414 mpc823 reference manual motorola smc communication 16 processor module clencharacter length this field is programmed with a value between 3 and 15 to obtain 4 to 16 bits per character. if the character length is less than 8 bits, the msbs of the byte in buffer memory are not used on transmit and are written with zeros on receive. on the other hand, if the character length is more than 8 bits but less than 16 bits, the msbs of the half-word in buffer memory are not used on transmit and are written with zeros on receive. bsbyte sequence this bit controls the sequence of byte transmission if the revd bit is set for a character length greater than 8 bits. it must be set to zero to maintain behavior compatibility with the mc68360 quicc microprocessor. 0 = normal mode. this must be selected if the character length is less than or equal to 8 bits. 1 = transmit lower address byte first. revdreverse data 0 = normal mode. 1 = reverse the character bit order. the msb is transmitted first. smsmcx mode 00 = gci or scit mode. 01 = reserved. 10 = uart mode. 11 = totally transparent mode. this must be selected for smcx transparent operation. dmdiagnostic mode 00 = normal mode. 01 = local loopback mode. 10 = echo mode. 11 = reserved. tensmcx transmit enable 0 = smcx transmitter disabled. 1 = smcx transmitter enabled. note: erratic behavior will occur if you do not write the values 0 to 2 to clen. larger character lengths increase the potential performance of the smcx channel and lower the performance impact of other channels. for instance, using 16-bit characters, rather than 8-bit characters is recommended if 16-bit characters are acceptable in the final application. note: once the ten bit is cleared, it must not be reenabled for at least three serial clocks.
communication processor module motorola mpc823 reference manual 16-415 smc communication 16 processor module rensmcx receive enable 0 = smcx receiver disabled. 1 = smcx receiver enabled. 16.11.7.10 smcx transparent receive buffer descriptor. using receive (rx) buffer descriptors, the communication processor module reports information about the received data for each buffer and closes the current buffer, generates a maskable interrupt, and starts to receive data into the next buffer after one of the following events occurs: ? an overrun error occurs ? a full receive buffer is detected ? the enter hunt mode command is issued eempty 0 = the data buffer associated with this rx buffer descriptor is filled with received data or data reception has been aborted due to an error condition. the core is free to examine or write to any fields of this rx buffer descriptor. the communication processor module does not use this buffer descriptor as long as the e bit is zero. 1 = the data buffer associated with this buffer descriptor is empty or is currently receiving data. this rx buffer descriptor and its associated receive buffer are owned by the communication processor module. once the e bit is set, the core must not write any fields of this rx buffer descriptor. bits 1, 4C5, 7C13, and 15reserved these bits are reserved and must be set to 0. note: the communication processor module sets all the status bits in this buffer descriptor, but you must clear them before submitting the buffer descriptor to the communication processor module. 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 offset + 0 e res wi reserved cm reserved ov res offset + 2 data length offset + 4 rx data buffer pointer offset + 6 note: you are only responsible for initializing the items in bold.
communication processor module 16-416 mpc823 reference manual motorola smc communication 16 processor module wwrap (final buffer descriptor in table) 0 = this is not the last buffer descriptor in the rx buffer descriptor table. 1 = this is the last buffer descriptor in the rx buffer descriptor table. after this buffer is used, the communication processor module receives incoming data into the first buffer descriptor that rbase points to in the table. the number of rx buffer descriptors in this table is programmable and determined only by the w bit and overall space constraints of the dual-port ram. iinterrupt 0 = no interrupt is generated after this buffer is filled. 1 = the rx bit in the smceCtransparent register is set when this buffer is completely filled by the communication processor module, thus indicating that the core needs to process the buffer. the rx bit can cause an interrupt if it is enabled. cmcontinuous mode 0 = normal operation. 1 = the e bit is not cleared by the communication processor module after this buffer descriptor is closed, thus allowing the associated data buffer to be automatically overwritten next time the communication processor module accesses this buffer descriptor. however, the e bit is cleared if an error occurs during reception, regardless of how the cm bit is set. ovoverrun this bit indicates that a receiver overrun has occurred during message reception. the communication processor module writes this bit after the received data is placed into the associated data buffer. data length this field represents the number of octets that the communication processor module writes into this data buffer. it is only written once by the communication processor module as the buffer is closed. the communication processor module writes this field after the received data is placed into the associated data buffer. rx data buffer pointer this field always points to the first location of the associated data buffer, must be even, and can reside in internal or external memory. the communication processor module writes these bits after the received data is placed into the associated data buffer. note: the actual amount of memory allocated for this buffer must be greater than or equal to the mrblr entry.
communication processor module motorola mpc823 reference manual 16-417 smc communication 16 processor module 16.11.7.11 smcx transparent transmit buffer descriptor. data is sent to the communication processor module for transmission on an smcx channel by arranging it in buffers referenced by the channels transmit (tx) buffer descriptor table. using the buffer descriptors, the communication processor module confirms transmission or indicates error conditions so that the processor knows the buffers have been serviced. rready 0 = the data buffer associated with this buffer descriptor is not ready for transmission and you are free to manipulate it or its associated data buffer. the communication processor module clears this bit after the buffer is transmitted or after an error condition is encountered. 1 = the data buffer, which you prepare for transmission, is not transmitted yet or is currently being transmitted. you cannot write any fields of this buffer descriptor once this bit is set. bits 1, 5, 7C13, and 15reserved these bits are reserved and must be set to 0. wwrap (final buffer descriptor in table) 0 = this is not the last buffer descriptor in the tx buffer descriptor table. 1 = this is the last buffer descriptor in the tx buffer descriptor table. after this buffer is used, the communication processor module receives incoming data into the first buffer descriptor that tbase points to in the table. the number of tx buffer descriptors in this table is programmable and determined by the w bit and overall space constraints of the dual-port ram. iinterrupt 0 = no interrupt is generated after this buffer is serviced. 1 = the tx and txe bits in the smceCtransparent register are set when this buffer is serviced. tx and txe can cause interrupts if they are enabled. 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 offset + 0 r res wi l res cm reserved un res offset + 2 data length offset + 4 tx data buffer pointer offset + 6 note: you are only responsible for initializing the items in bold. note: the communication processor module sets all the status bits in this buffer descriptor, but you must clear them before submitting the buffer descriptor to the communication processor module.
communication processor module 16-418 mpc823 reference manual motorola smc communication 16 processor module l last in message 0 = the last byte in the buffer is not the last byte in the transmitted transparent frame. data from the next transmit buffer (if ready) is transmitted immediately following the last byte of this buffer. 1 = the last byte in this buffer is the last byte in the transmitted transparent frame. after this buffer is transmitted, the transmitter requires synchronization before the next buffer is transmitted. cmcontinuous mode 0 = normal operation. 1 = the communication processor module does not clear the r bit after this buffer descriptor is closed, thus allowing the associated data buffer to be automatically retransmitted next time the communication processor module accesses this buffer descriptor. however, the r bit will be cleared if an error occurs during transmission, regardless of how the cm bit is set. ununderrun this bit indicates that a serial management controller has encountered a transmitter underrun condition while transmitting the associated data buffer. data length this field represents the number of octets that the communication processor module must transmit from this data buffer and it is never modified by the communication processor module. this field can be even or odd, but if the number of bits in the transparent character is greater than 8, this field must be even. for example, to transmit three transparent 8-bit characters, this field must be initialized to 3. however, to transmit three transparent 9-bit characters, this field must be initialized to 6 since the three 9-bit characters occupy three half-words in memory. tx data buffer pointer this field always points to the first byte of the associated data buffer. they can be even or odd, unless the character length is greater than 8 bits, in which case this field must be even. for instance, the pointer to 8-bit transparent characters can be even or odd, but the pointer to 9-bit transparent characters must be even. the buffer can reside in internal or external memory.
communication processor module motorola mpc823 reference manual 16-419 smc communication 16 processor module 16.11.7.12 smcx transparent event register. when a serial management controller is in transparent mode, the 8-bit memory-mapped smcx event register is referred to as the smcx transparent event (smceCtransparent) register. it is used to generate interrupts and report events recognized by the smcx channel. when an event is recognized, the serial management controller sets the corresponding bit in this register. interrupts generated by this register can be masked in the smcmCtransparent register. a bit is cleared by writing a 1 (writing a zero has no effect) and more than one bit can be cleared at a time. all unmasked bits must be cleared before the communication processor module clears the internal interrupt request. this register is cleared at reset and can be read at any time. bits 0C2 and 4reserved these bits are reserved and must be set to 0. txetx error this bit indicates that an underrun error has occurred on the transmitter channel. bsybusy condition this bit indicates that a character has been received and discarded due to a lack of buffers. reception begins after a new buffer is provided. you can execute an enter hunt mode command to make the receiver wait for resynchronization. txtx buffer this bit indicates that a buffer has been transmitted. if the l bit of the tx buffer descriptor is set, this bit is set when the last data character starts being transmitted and you must wait one character time to be sure that the data is completely sent over the transmit pin. if the l bit of the tx buffer descriptor is cleared, this bit is set when the last data character is written to the transmit fifo and you must wait two character times to be sure that the data is completely sent over the transmit pin. rxrx buffer this bit indicates that a data buffer has been received on the smcx channel and its associated rx buffer descriptor is now closed. this bit is set after the last character is written to the buffer. smceCtransparent bit 0 1 2 3 4 5 6 7 field reserved txe res bsy tx rx reset 0 00000 r/w r/w r/w r/w r/w r/w r/w addr (immr & 0xffff0000) + 0xa86 (smc1), 0xa96 (smc2)
communication processor module 16-420 mpc823 reference manual motorola smc communication 16 processor module 16.11.7.13 smcx transparent mask register. when a serial management controller is in transparent mode, the 8-bit read/write smcx mask register is referred to as the smcx transparent mask (smcmCtransparent) register. it has the same bit format as the smceCtransparent register. if a bit in this register is a 1, the corresponding interrupt in the smceCtransparent register is enabled. if the bit is zero, the corresponding interrupt is masked. 16.11.7.14 smcx transparent nmsi programming example. the following is an example initialization sequence for an smc1 transparent channel over its own set of pins. the transmit and receive clocks are provided by the clk3 pin and the smsyn1 pin is used to obtain synchronization. 1. configure the port b pins to enable the smtxd1, smrxd1, and smsyn1 pins. write pbpar bits 25, 24, and 23 with ones and then pbdir and pbodr bits 25, 24, and 23 with zeros. 2. configure the port a pins to enable clk3. write papar bit 5 with a one and padir bit 5 with a zero. the other functions of this pin are the timers or the time-slot assigner. these alternate functions cannot be used on this pin. 3. connect the clk3 clock to smc1 using the serial interface. write the smc1 bit in the simode register with a 0 and the smc1cs field in the simode register with 110. 4. write rbase and tbase in the smcx parameter ram to point to the rx buffer descriptor and tx buffer descriptor in the dual-port ram. assuming one rx buffer descriptor at the beginning of the dual-port ram and one tx buffer descriptor following that rx buffer descriptor, write rbase with 0x2000 and tbase with 0x2008. 5. program the cpcr to execute the init rx and tx params command. write 0x0091 to the cpcr. 6. write 0x0001 to the sdcr to initialize the sdma configuration register. 7. write 0x18 to rfcr and tfcr for normal operation. 8. write mrblr with the maximum number of bytes per receive buffer. assume 16 bytes, so mrblr = 0x0010. 9. initialize the rx buffer descriptor and assume the rx data buffer is at 0x00001000 in main memory. write 0xb000 to rx_bd_status, 0x0000 to rx_bd_length (optional), and 0x00001000 to rx_bd_pointer. smcmCtransparent bit 0 1 2 3 4 5 6 7 field reserved txe res bsy tx rx reset 0 00000 r/w r/w r/w r/w r/w r/w r/w addr (immr & 0xffff0000) + 0xa8a (smc1), 0xa9a (smc2)
communication processor module motorola mpc823 reference manual 16-421 smc communication 16 processor module 10. initialize the tx buffer descriptor and assume the tx data buffer is at 0x00002000 in main memory and contains five 8-bit characters. write 0xb000 to tx_bd_status, 0x0005 to tx_bd_length, and 0x00002000 to tx_bd_pointer. 11. write 0xff to the smceCtransparent register to clear any previous events. 12. write 0x13 to the smcmCtransparent register to enable all possible serial management controller interrupts. 13. write 0x00000010 to the cimr to allow smc1 to generate a system interrupt. the cicr must also be initialized. 14. write 0x3830 to the smcmr to configure 8-bit characters, unreversed data, and normal operation (not loopback). notice that the transmitter and receiver have not been enabled yet. 15. write 0x3833 to the smcmr to enable the smcx transmitter and receiver. this additional write ensures that the ten and ren bits are enabled last. 16.11.7.15 smc1 transparent tsa programming example. the following is an example initialization sequence for the smc1 transparent channel over the time-slot assigner. it is assumed that the time-slot assigner and tdm pins have already been set up to route time-slot data to the smc1 transmitter and receiver. refer to section 16.7 the serial interface with time-slot assigner for examples of how to configure the time-slot assigner. the transmit and receive clocks and synchronization signals are provided internally from the time-slot assigner. 1. write rbase and tbase in the smc1 parameter ram to point to the rx buffer descriptor and tx buffer descriptor in the dual-port ram. assuming one rx buffer descriptor at the beginning of the dual-port ram and one tx buffer descriptor following that rx buffer descriptor, write rbase with 0x2000 and tbase with 0x2008. 2. program the cpcr to execute the init tx and rx params command. write 0x0091 to the cpcr. 3. write 0x0001 to the sdcr to initialize the sdma configuration register. 4. write 0x18 to rfcr and tfcr for normal operation. 5. write mrblr with the maximum number of bytes per receive buffer. assume 16 bytes, so mrblr = 0x0010. 6. initialize the rx buffer descriptor and assume the rx data buffer is at 0x00001000 in main memory. write 0xb000 to rx_bd_status, 0x0000 to rx_bd_length (optional), and 0x00001000 to rx_bd_pointer. note: after 5 bytes are transmitted, the tx buffer descriptor is closed and after 16 bytes are received the receive buffer is closed too. any data received after 16 bytes causes a busy (out-of-buffers) condition since only one rx buffer descriptor is prepared.
communication processor module 16-422 mpc823 reference manual motorola smc communication 16 processor module 7. initialize the tx buffer descriptor and assume the tx data buffer is at 0x00002000 in main memory and contains five 8-bit characters. write 0xb000 to tx_bd_status, 0x0005 to tx_bd_length, and 0x00002000 to tx_bd_pointer. 8. write 0xff to the smceCtransparent register to clear any previous events. 9. write 0x13 to the smcmCtransparent register to enable all possible serial management controller interrupts. 10. write 0x00000010 to the cimr so that smc1 can generate a system interrupt. the cicr must also be initialized. 11. write 0x3830 to the smcmrCtransparent to configure 8-bit characters, unreversed data, and normal operation (not loopback). notice that the transmitter and receiver are not enabled yet. 12. write 0x3833 to the smcmrCtransparent to enable the smc1 transmitter and receiver. this additional write ensures that the ten and ren bits are enabled last. 16.11.7.16 handling interrupts in the smcx. follow these steps to handle an interrupt in the serial management controller: 1. once an interrupt occurs, read the smce register to discover the cause of the interrupts. the smce bits are usually cleared at this time. 2. process the tx buffer descriptor to reuse it if the tx bit is set in the smceC transparent register. extract data from the rx buffer descriptor if the rx bit is set in the smceCtransparent register. to transmit another buffer, simply set the r bit in the rx buffer descriptor. 3. clear the smc1 bit in the cisr. 4. execute the rfi instruction. 16.11.8 the smcx in gci mode the serial management controllers can be used to control the circuit interface and monitor channels of the general circuit interface (gci) frame. when using the scit configuration of a general circuit interface, one serial management controller can handle scit channel 0, and the other serial management controller can handle scit channel 1. the main features of a serial management controller in gci mode are as follows: ? each smcx channel supports the circuit interface and monitor channels of the gci (iom-2) in isdn applications ? two serial management controllers support the two sets of circuit interface and monitor channels in scit channels 0 and 1 ? full-duplex operation ? local loopback and echo capability for testing
communication processor module motorola mpc823 reference manual 16-423 smc communication 16 processor module to use the smcx gci channels properly, the time-slot assigner in the serial interface must be configured to route the monitor and circuit interface channels to the serial management controller you prefer. refer to section 16.7 the serial interface with time-slot assigner for more details on how to program this configuration. a serial management controller in gci mode is also referred to as the smcx gci controller. 16.11.8.0.1 smcx gci monitor channel transmission process. the monitor channel 0 is used to exchange data with a layer 1 device (reading and writing internal registers and transferring the s and q bits). monitor channel 1 is used for programming and controlling voice/data modules, such as codecs. the core writes the data byte into the transmit (tx) buffer descriptor. the serial management controller transmits the data on the monitor channel and handles the a and e control bits according to the gci monitor channel protocol. you can issue the timeout command to solve deadlocks when errors in the a and e bit occur on the data line. 16.11.8.0.2 smcx gci monitor channel reception process. the serial management controller receives data and handles the a and e control bits according to the gci monitor channel protocol. when the communication processor module stores a received data byte in the smcx receive (rx) buffer descriptor, a maskable interrupt is generated. you can issue the transmit abort request command and the mpc823 transmits an abort request on the e bit. 16.11.8.1 handling the smcx circuit interface channel. the circuit interface channel is used to control the layer 1 device. the layer 2 device in the te sends commands and receives indication to or from the upstream layer 1 device via circuit interface channel 0. in the scit configuration, circuit interface channel 1 is used to convey real-time status information between the layer 2 device and nonlayer 1 peripheral devices (codecs). 16.11.8.1.1 smcx gci circuit interface channel transmission process. the core writes the data byte into the circuit interface tx buffer descriptor and the serial management controller transmits the data continuously on the circuit interface channel to the physical layer device. 16.11.8.1.2 smcx gci circuit interface channel reception process. the smcx receiver continuously monitors the circuit interface channel and when it recognizes a change in the data and this value is received in two successive frames, it is interpreted as valid data. this is referred to as the double last-look method. the received data byte is stored by the communication processor module in the circuit interface rx buffer descriptor and a maskable interrupt is generated. if the serial management controller is configured to support scit channel 1, the double last-look method is not used.
communication processor module 16-424 mpc823 reference manual motorola smc communication 16 processor module 16.11.8.2 smcx gci parameter ram memory map. the smcx gci parameter ram area begins at the same offset from each smcx base area. the smcx in gci mode has a very different parameter ram memory map than the smcx in uart or transparent mode. in gci mode, the general-purpose parameter ram contains the buffer descriptors, instead of pointers, to the buffer descriptors. you can see the difference when you compare table 16-38 with table 16-36. the smcx in gci mode contains no protocol-specific parameter ram. ? m_rxbdthe smcx monitor channel receive buffer descriptor is used by the communication processor module to report information about the monitor channel receive byte. eempty when a serial management controller uses the monitor channel protocol, it waits until the core sets this bit before acknowledging the monitor channel data. 0 = the communication processor module clears this bit to indicate that the data byte associated with this buffer descriptor is now available to the core. 1 = the core sets this bit to indicate that the data byte associated with this buffer descriptor has been read. table 16-38. smcx gci parameter ram memory map address name width description smcx base + 00 m_rxbd half-word monitor channel rx buffer descriptor smcx base + 02 m_txbd half-word monitor channel tx buffer descriptor smcx base + 04 ci_rxbd half-word circuit interface channel rx buffer descriptor smcx base + 06 ci_txbd half-word circuit interface channel tx buffer descriptor smcx base + 08 temp1 half-word smcbase + 0a temp2 half-word smcx base + 0c temp3 half-word smcx base + 0e temp4 half-word note: you are only responsible for initializing the items in bold. smcx base = (immr & 0xffff0000) + 0x3e80 (smc1) and 0x3f80 (smc2). 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 offset + 0 e l re ms reserved data note: you are only responsible for initializing the items in bold.
communication processor module motorola mpc823 reference manual 16-425 smc communication 16 processor module llast (eom) this bit is only valid when a serial management controller implements the monitor channel protocol and is set when the eom indication is received on the e bit. when this bit is set, the data byte is invalid. ererror condition this bit is only valid when a serial management controller implements the monitor channel protocol and is set when an error condition occurs on the monitor channel protocol. a new byte is transmitted before a serial management controller acknowledges the previous byte. msdata mismatch this bit is only valid when a serial management controller implements the monitor channel protocol. it is set when two different consecutive bytes are received and it is cleared when the last two consecutive bytes match. a serial management controller waits for the reception of two identical consecutive bytes before writing new data to the rx buffer descriptor. bits 4C7reserved these bits are reserved and must be set to 0. datadata this field contains the monitor channel data byte that a serial management controller received. ? m_txbdthe smcx monitor channel transmit buffer descriptor is used by the communication processor module to report information about the monitor channel transmit byte. rready 0 = this bit is cleared by the communication processor module after transmission. the tx buffer descriptor is now available to the core. 1 = the core sets this bit to indicate that the data byte associated with this buffer descriptor is ready for transmission. llast (eom) this bit is only valid when a serial management controller implements the monitor channel protocol. when it is set, a serial management controller first transmits the buffer data and then transmits the eom indication on the e bit. 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 offset + 0 rlar reserved data note: you are only responsible for initializing the items in bold.
communication processor module 16-426 mpc823 reference manual motorola smc communication 16 processor module arabort request this bit is only valid when a serial management controller uses the monitor channel protocol and it is set by a serial management controller when an abort request is received on the a bit. the smcx transmitter transmits the eom on the e bit after an abort request is received. bits 3C7reserved these bits are reserved and must be set to 0. datadata field this field contains the data to be transmitted by a serial management controller on the monitor channel. ? c/i_rxbdthe smcx circuit interface channel receive (rx) buffer descriptor is used by the communication processor module to report information about the circuit interface channel receive byte. eempty 0 = the communication processor module clears this bit to indicate that the data byte associated with this buffer descriptor is now available to the core. 1 = the core set this bit to indicate that the data byte associated with this buffer descriptor has been read. bits 1C7 and 14C15reserved these bits are reserved and must be set to 0. c/i datacommand/indication data bits this field represents a 4-bit data field for circuit interface channel 0 and a 6-bit data field for circuit interface channel 1. it contains the data received from the circuit interface channel. for circuit interface channel 0, bits 10-13 contain the 4-bit data field and bits 8 and 9 are always written with zeros. for circuit interface channel 1, bits 8-13 contain the 6-bit data field. 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 offset + 0 e res c/i data reserved note: additional data received is discarded until the e bit is set.
communication processor module motorola mpc823 reference manual 16-427 smc communication 16 processor module ? c/i_txbdthe smcx circuit interface channel transmit (tx) buffer descriptor is used by the communication processor module to report information about the circuit interface channel transmit byte. rready 0 = the communication processor module clears this bit after transmission to indicate that the buffer descriptor is now available to the core. 1 = the core sets this bit to indicate that the data associated with this buffer descriptor is ready for transmission. bits 1C7 and 14C15reserved these bits are reserved and must be set to 0. c/i datacommand/indication data bits this field represents a 4-bit data field for circuit interface channel 0 and a 6-bit data field for circuit interface channel 1. it contains the data to be transmitted onto the circuit interface channel. for circuit interface channel 0, bits 10-13 contain the 4-bit data field and bits 8 and 9 are always written with zeros. for circuit interface channel 1, bits 8-13 contain the 6-bit data field. ? temp1C4these bits are used internally by the risc microcontroller. 16.11.8.3 smcx gci commands. the following commands are issued to the cpm command register. ? init tx and rx params this command initializes the transmit and receive parameters in the parameter ram to their reset state and it is especially useful when switching protocols on a given serial channel. ? transmit abort request this receiver command can be issued when the mpc823 implements the monitor channel protocol. when it is issued, the mpc823 sends an abort request on the a bit. ? timeout this transmitter command can be issued when the mpc823 implements the monitor channel protocol and it is usually issued because the device is not responding or a bit errors are detected. the mpc823 sends an abort request on the e bit at the time this command is issued. 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 offset + 0 r reserved c/i data reserved
communication processor module 16-428 mpc823 reference manual motorola smc communication 16 processor module 16.11.8.4 smcx gci mode register. when a serial management controller is in gci mode, the 16-bit, memory-mapped, read/write smcx mode register is referred to as the smcx gci mode (smcmCgci) register. the functions of bits 8C15 are common to each smcx protocol, but bits 0C7 vary according to the protocol selected by the sm bits. bits 0, 6, and 8C9reserved these bits are reserved and must be set to 0. clencharacter length this field is used to define the total number of bits in the circuit interface and monitor channels of the scit channels 0 or 1. clen ranges from 0 to 15 and specifies values from 1 to 16 bits. clen must be written with 13 for the scit channel 0 or gci (8 data bits, plus a and e bits, plus 4 circuit interface bits = 14 bits) or with 15 for the scit channel 1 (8 data, bits, plus a and e bits, plus 6 circuit interface bits = 16 bits). memonitor enable 0 = the serial management controller does not support the monitor channel. 1 = the serial management controller supports the monitor channel with the monitor channel protocol. c#scit channel number 0 = scit channel 0. 1 = scit channel 1. required for siemens arcofi and sgs s/t chips. smsmcx mode 00 = gci or scit mode. required for smcx gci or scit operation. 01 = reserved. 10 = uart mode. 11 = totally transparent mode. dmdiagnostic mode 00 = normal mode. 01 = local loopback mode. 10 = echo mode. 11 = reserved. smcmCgci bit 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 field res clen me res c# res sm dm ten ren reset 0 0 000 0 0 0 00 r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w addr (immr & 0xffff0000) + 0xa82 (smcmr1), 0xa92 (smcmr2)
communication processor module motorola mpc823 reference manual 16-429 smc communication 16 processor module tensmcx transmit enable 0 = smcx transmitter disabled. 1 = smcx transmitter enabled. rensmcx receive enable 0 = smcx receiver disabled. 1 = smcx receiver enabled. 16.11.8.5 smcx gci event register. when a serial management controller is in gci mode, the 8-bit memory-mapped smcx event register is referred to as the smcx gci event (smceCgci) register. it is used to generate interrupts and report events recognized by the smcx channel. when an event is recognized, a serial management controller sets the corresponding bit in this register. interrupts generated by this register can be masked in the smcmCgci register. a bit is cleared by writing a 1 (writing a zero has no effect) more than one bit can be cleared at a time. all unmasked bits must be cleared before the communication processor module clears the internal interrupt request to the cpm interrupt controller. this register is cleared by reset and can be read at any time. bits 0C3reserved these bits are reserved and must be set to 0. ctxbcircuit interface channel buffer transmitted this bit indicates that the circuit interface transmit buffer is now empty. crxbcircuit interface channel buffer received this bit indicates when the circuit interface receive buffer is full. mtxbmonitor channel buffer transmitted this bit indicates that the monitor transmit buffer is now empty. mrxbmonitor channel buffer received this bit indicates when the monitor receive buffer is full. smceCgci bit 0 1 2 3 4 5 6 7 field reserved ctxb crxb mtxb mrxb reset 0 0000 r/w r/w r/w r/w r/w r/w addr (immr & 0xffff0000) + 0xa86 (smc1), 0xa96 (smc2)
communication processor module 16-430 mpc823 reference manual motorola spi communication 16 processor module 16.11.8.6 smcx gci mask register. when a serial management controller is in gci mode, the 8-bit, memory-mapped, read/write smcx mask register is referred to as the smcx gci mask (smcmCgci) register. it has the same bit format as the smceCgci register. if a bit in this register is a 1, the corresponding interrupt in the smceCgci is enabled. if the bit is zero, the corresponding interrupt in the smceCgci is masked. 16.12 the serial peripheral interface the serial peripheral interface (spi) allows the mpc823 to exchange data between other mpc8xx microprocessors, the mc68328, mc68360, and mc68302 embedded microprocessors, as well as the mc68hc11 and mc68hc05 microcontroller families and a variety of peripheral devices. the serial peripheral interface is a full-duplex, synchronous, character-oriented channel that supports a four-wire interface (receive, transmit, clock and slave select). the spi block consists of transmitter and receiver sections, an independent baud rate generator, and a control unit. the transmitter and receiver sections use the same clock, which is derived from the spi baud rate generator in master mode and generated externally in slave mode. during an spi transfer, data is transmitted and received simultaneously. because the spi receiver and transmitter are double-buffered, as illustrated in the block diagram below, the effective fifo size is 2 characters. you can program the mpc823 serial peripheral interface to shift out the most- or least-significant bit first. when the serial peripheral interface is not enabled in the spmode register, it consumes very little power. smcmCgci bit 0 1 2 3 4 5 6 7 field reserved ctxb crxb mtxb mrxb reset 0 0000 r/w r/w r/w r/w r/w r/w addr (immr & 0xffff0000) + 0xa8a (smc1), 0xa9a(smc2)
communication processor module motorola mpc823 reference manual 16-431 spi communication 16 processor module 16.12.1 features the following is a list of the serial peripheral interfaces main features: ? four-wire interface (spimosi, spimiso, spiclk, and spisel ) ? full-duplex operation ? works with data characters from 4 to 16 bits long ? supports back-to-back character transmission and reception ? master or slave spi modes supported ? multimaster environment support ? continuous transfer mode for autoscanning peripherals ? supports maximum clock rates of 6.25mhz in master mode and 12.5mhz in slave mode, assuming a 25mhz system clock is used ? independent programmable baud rate generator ? programmable clock phase and polarity ? open-drain output pins support multimaster configuration ? local loopback capability for testing figure 16-120. spi block diagram transmit_reg receive_reg shift_register counter pins interface spi mode reg peripheral bus imb spi brg spimiso spimosi spiclk in_clk rxd txd brgclk spisel
communication processor module 16-432 mpc823 reference manual motorola spi communication 16 processor module 16.12.2 spi clocking and pin functions you can configure the serial peripheral interface as a master for the serial channel or as a slave. you can also use it in a multimaster environment. when the serial peripheral interface is a master, use the spi baud rate generator to generate the spi transmit and receive clocks. it takes its input from the brgclk, which is generated in the clock synthesizer of the mpc823, specifically for the spi baud rate generator and the other three baud rate generators in the communication processor module. the spimiso pin is an input in master mode and an output in slave mode. it follows then, that the spimosi pin is an output in master mode and an input in slave mode. the spimosi and spimiso pins change functionality between master and slave mode to support a multimaster configuration that allows communication from one serial peripheral interface to another with the same hardware configuration. when the serial peripheral interface is in master mode, spiclk is the clock output signal that shifts in the received data from the spimiso pin and shifts out the transmitted data to the spimosi pin. additionally, an spi master device must provide a slave-select signal output to enable the spi slave devices. you can implement this by using one of the mpc823 general-purpose i/o pins. the spisel pin must not be asserted while the serial peripheral interface is in master mode or an error will occur. when the serial peripheral interface is in slave mode, spiclk is the clock input signal that shifts in the received data from the spimosi pin and shifts out the transmitted data to the spimiso pin. the spisel pin provided by the mpc823 is the enable input to the spi slave. when the serial peripheral interface is operating in a multimaster environment, the spisel pin is still an input and is used to detect an error condition when more than one master is operating. using the fields in the spi mode register, you can select any of the four combinations of the gated spiclk phase and polarity. the spi pins can also be configured as open-drain pins to support a multimaster configuration in which the same spi pin is driven by the mpc823 or an external spi device.
communication processor module motorola mpc823 reference manual 16-433 spi communication 16 processor module 16.12.3 the spi transmission and reception process when the serial peripheral interface is in master mode, it transmits a message to the peripheral or slave, which sends back an immediate reply. when the mpc823 has more than one slave, it can use the general-purpose parallel i/o pins to selectively enable different slaves. to start the data exchange process, the core writes the data to be transmitted into a data buffer, configures a transmit (tx) buffer descriptor with its r bit set, and configures one or more receive (rx) buffer descriptors. the core then sets the str bit in the spcom register to start transmitting data, which starts when the sdma channel loads the transmit fifo with data. the serial peripheral interface then generates programmable clock pulses on the spiclk pin for each character and shifts the data out on the spimosi pin. at the same time, the serial peripheral interface shifts received data in from the spimiso pin. this received data is written into a receive buffer using the next available rx buffer descriptor. the serial peripheral interface continues transmitting and receiving characters until the transmit buffer has been completely transmitted or an error has occurred. the communication processor module then clears the r and e bits in the tx and rx buffer descriptors and may issue a maskable interrupt to the cpm interrupt controller. when multiple tx buffer descriptors are ready to be transmitted, the l bit in the tx buffer descriptor determines whether or not the serial peripheral interface must continue transmitting without waiting for the str bit to be set again. if the l bit is cleared, the data from the next tx buffer descriptor begins transmitting after data from the first tx buffer descriptor is transmitted. if the l bit is set, transmission stops after data from this tx buffer descriptor has finished transmitting. in addition, the current rx buffer descriptor that is used to receive data is closed after transmission stops, even if the receive buffer is not full. this means that you do not need to provide receive buffers that are the same length as the transmit buffers. if the serial peripheral interface is the only master in a system, then the spisel pin can be used as a general-purpose i/o, and the internal spisel signal to the serial peripheral interface is always forced internally inactive, thus eliminating the possibility of a multimaster error. when the serial peripheral interface is in slave mode, it receives messages from an spi master and sends back an immediate reply. the spisel pin must be asserted before receive clocks are recognized and once spisel is asserted, the spiclk pin becomes an input from the master to the slave. spiclk can be any frequency from the dc to the brgclk/2, which is 12.5mhz for a 25mhz system. before the data is exchanged, the core writes the data to be transmitted into a data buffer, configures a tx buffer descriptor with its r bit set, and configures one or more rx buffer descriptors. the core then sets the str bit in the spcom register to enable the serial peripheral interface so it will prepare the data for transmission and wait for the spisel pin to be asserted. data is shifted out from the slave on the spimiso pin and shifted in through the spimosi pin. a maskable interrupt is issued when a full buffer finishes receiving and transmitting or after an error occurs. using the next rx buffer descriptor in the ring, the serial peripheral interface continues reception until it runs out of receive buffers or the spisel pin is negated.
communication processor module 16-434 mpc823 reference manual motorola spi communication 16 processor module transmission continues until no more data is available or the spisel pin is negated. if the pin is negated before all the data is transmitted, it stops, but the tx buffer descriptor stays open. further transmission continues once the spisel pin is reasserted and spiclk begins toggling. after the characters in the tx buffer descriptor are transmitted, the serial peripheral interface transmits ones if spisel is not negated. 16.12.3.1 multimaster operation. the serial peripheral interface can operate in a multimaster environment in which more than one spi device is connected to the same bus. in this configuration, the spimosi, spimiso, and spiclk pins of all spis are connected together and the spisel input pins are connected separately. in this environment, only one spi device can be in master mode and all the others must be in slave mode. when the serial peripheral interface is configured as a master and its spisel signal goes active or low, a multimaster error will occur because more than one spi device is a bus master. the serial peripheral interface sets the mme bit in the spie register and a maskable interrupt is issued to the core. it also disables spi operation and the output drivers of the spi pins. the core must clear the en bit the spmode register before using the serial peripheral interface again. after the problems are corrected, clear the mme bit and enable the serial peripheral interface the same way you would after a reset. note: the maximum sustained data rate that the serial peripheral interface supports is systemclk/50. however, the serial peripheral interface can transfer a single character at much higher rates. for instance, systemclk/4 in master mode and systemclk/2 in slave mode. if multiple characters are to be transmitted, you must insert gaps between them so that it will not exceed the maximum sustained data rate.
communication processor module motorola mpc823 reference manual 16-435 spi communication 16 processor module 16.12.3.2 spi parameter ram memory map. the spi parameter ram area begins at the spi base address and is used for the general spi parameters. notice that it is similar to the sccx general-purpose parameter ram. you must initialize certain parameter ram values before the serial peripheral interface is enabled. the communication processor module initilizes the other values. once initialized, the parameter ram values do not usually need to be accessed by your software. they only need to be modified when there is no serial peripheral interface activity in progress. ? rbase and tbasethe dual-port ram starts receiving and transmitting data for the rx and tx buffer descriptors in the rbase and tbase entries. they provide a great deal of flexibility for partitioning buffer descriptors for a serial peripheral interface. you must initialize these entries before enabling the corresponding channel. you must not configure the spi buffer descriptor tables to overlap with the tables of the usb, smcx, and sccx or erratic operation will occur. rbase and tbase must contain a value that is divisible by eight. table 16-39. spi parameter ram memory map address name width description spi base + 00 rbase half-word rx buffer descriptor base address spi base+ 02 tbase half-word tx buffer descriptor base address spi base+ 04 rfcr byte rx function code spi base+ 05 tfcr byte tx function code spi base+ 06 mrblr half-word maximum receive buffer length spi base+ 08 rstate word rx internal state spi base+ 0c rptr word rx internal data pointer spi base + 10 rbptr half-word rx buffer descriptor pointer spi base + 12 rcnt half-word rx internal byte count spi base + 14 rtmp word rx temp spi base + 18 tstate word tx internal state spi base + 1c tptr word tx internal data pointer spi base + 20 tbptr half-word tx buffer descriptor pointer spi base + 22 tcnt half-word tx internal byte count spi base + 24 ttmp word tx temp note: you are only responsible for initializing the items in bold. spi base = (immr & 0xffff0000) + 0x3d80. sccx ethernet parameter ram space overlaps the spi parameter ram space. the address range for sccx space is 0x1000 through 0x1ca3. you need a microcode patch to run spi and ethernet concurrently.
communication processor module 16-436 mpc823 reference manual motorola spi communication 16 processor module ? rfcr and tfcrthe receive and transmit function code register entries contain the value that you want to appear on the at pins when the associated sdma channel accesses memory. this register controls the byte-ordering convention used in the transfers. bits 0C2reserved these bits are reserved and must be set to 0. bobyte ordering you must set these bits to select the required byte ordering of the data buffer. 00 = the dec/intel convention is used for byte ordering (swapped operation) and is also called little-endian byte ordering. the transmission order of bytes within a buffer word is reversed in comparison to the motorola mode. this mode is supported only for 32-bit port size memory. 01 = powerpc little-endian byte ordering. as data is transmitted onto the serial line from the data buffer, the least-significant byte of the buffer double-word contains data to be transmitted earlier than the most-significant byte of the same buffer double-word. 1x = motorola byte ordering (normal operation) is also called big-endian byte ordering. as data is transmitted onto the serial line from the data buffer, the most-significant byte of the buffer word contains data to be transmitted earlier than the least-significant byte of the same buffer word. ataddress type 1C3 these bits contain the function code value used during the sdma channel memory access. at0 is driven with a 1 to identify this sdma channel access as a dma-type access. rfcr bit 0 1 2 3 4 5 6 7 field reserved bo at reset 000 r/w r/w r/w r/w addr spi base + 0x04 tfcr bit 0 1 2 3 4 5 6 7 field reserved bo at reset 000 r/w r/w r/w r/w addr spi base + 0x05
communication processor module motorola mpc823 reference manual 16-437 spi communication 16 processor module bits 0C2reserved these bits are reserved and must be set to 0. bobyte ordering you must set these bits to select the required byte ordering of the data buffer. if this bit field is modified on-the-fly, it takes effect at the beginning of the next frame or at the beginning of the next buffer descriptor. 00 = the dec/intel convention is used for byte ordering (swapped operation) and is also called little-endian byte ordering. the transmission order of bytes within a buffer word is reversed in comparison to the motorola mode. this mode is supported only for 32-bit port size memory. 01 = powerpc little-endian byte ordering. as data is transmitted onto the serial line from the data buffer, the least-significant byte of the buffer double-word contains data to be transmitted earlier than the most-significant byte of the same buffer double-word. 1x = motorola byte ordering (normal operation) is also called big-endian byte ordering. as data is transmitted onto the serial line from the data buffer, the most-significant byte of the buffer word contains data to be transmitted earlier than the least-significant byte of the same buffer word. ataddress type 1C3 these bits contain the function code value used during the sdma channel memory access. at0 is driven with a 1 to identify this sdma channel access as a dma-type access. ? mrblrthe serial peripheral interface has one maximum receive buffer length entry to define its receive buffer length and it defines the maximum number of bytes that the mpc823 writes to a receive buffer on the serial peripheral interface before moving to the next buffer. the mpc823 can write fewer bytes to the buffer than the mrblr value if an error or end-of-frame occurs, but it never writes more bytes than the mrblr value. buffers you supply for the mpc823 to use must always be at least as long as mrblr. the transmit buffers for a serial peripheral interface are not affected by the value you program into mrblr and they can have different lengths, as needed. you can choose the number of bytes to be transmitted by programming the data length field in the tx buffer descriptor. note: the mrblr is not intended to be dynamically changed while a serial management controller is operating. however, if it is modified in a single bus cycle with one 16-bit move (not two 8-bit bus cycles back-to-back), then a dynamic change in the receive buffer length can be successfully achieved. this occurs when the communication processor module transfers control to the next rx buffer descriptor in the table. thus, a change to mrblr does not have an immediate effect. to guarantee that the change occurs on a particular rx buffer descriptor, you must only change the mrblr while the smcx receiver is disabled. the value of mrblr must be greater than zero and it must be even if the character length of the data is greater than 8 bits.
communication processor module 16-438 mpc823 reference manual motorola spi communication 16 processor module ? rrbptrthe rx buffer descriptor pointer entry for each spi channel points to the next buffer descriptor that the receiver transfers data to when it is idle or to the current buffer descriptor during frame processing. after a reset or when the end of the buffer descriptor table is reached, the communication processor module initializes this pointer to the value programmed in the rbase entry. although in most applications you must not write rbptr, it can be modified when the receiver is disabled or when you are sure that no receive buffer is currently in use. ? tbptrthe tx buffer descriptor pointer entry for each spi channel points to the next buffer descriptor that the transmitter transfers data from when it is idle or to the current buffer descriptor during frame transmission. after a reset or when the end of buffer descriptor table is reached, the communication processor module initializes this pointer to the value programmed in the tbase entry. although in most applications you must not write tbptr, it can be modified when the transmitter is disabled or when you are sure that no transmit buffer is currently in use. ? other general parametersfor normal operation, you do not need to access these parameters. they are only listed here because they provide helpful information for debugging purposes. additional parameters are listed in table 16-39. rptr and tptr are updated by the sdma channels to show the next address in the buffer to be accessed. tcnt is a down-count value initialized with the data length field of the tx buffer descriptor and decremented with every byte read by the sdma channels. the rcnt is a down-count value that is initialized with the mrblr value and decremented with every byte the sdma channels write. the rstate, tstate, rtmp, tmp, and reserved areas can only be used by the risc microcontroller. 16.12.3.3 spi commands. the following transmit and receive commands are issued to the cpm command register (cpcr). ? init tx parameters this command initializes all transmit parameters in the serial channel parameter ram to their reset state and must only be issued when the transmitter is disabled. the init tx and rx params command can also be used to reset the transmit and receive parameters. ? close rx bd this command is used to force the spi controller to close the current rx buffer descriptor if it is currently being used and to use the next buffer descriptor for any subsequently received data. if the spi controller is not in the process of receiving data, no action is taken by this command. ? init rx parameters this command initializes all the receive parameters in this serial channel parameter ram to their reset state and must only be issued when the receiver is disabled. the init tx and rx params command can also be used to reset the receive and transmit parameters. note: to extract data from a partially full buffer, issue the close rx bd command.
communication processor module motorola mpc823 reference manual 16-439 spi communication 16 processor module 16.12.3.4 spi buffer descriptor ring. the data associated with the serial peripheral interface is stored in buffers, which are referenced by buffer descriptors organized in a buffer descriptor ring located in the dual-port ram. this ring has the same basic configuration as the sccx, smcx, usb, and i 2 c controllers. the buffer descriptor ring forms a circular queue that helps you organize the buffers you want to transmit or receive. using the buffer descriptors, the communication processor module confirms reception and transmission or indicates error conditions so that the processor knows the buffers have been serviced. the actual buffers can reside in either external or internal memory and the data buffers can reside in the parameter area of another unused controller if it is not enabled. figure 16-121. spi memory format frame status data length data pointer pointer to spi tx ring dual-port ram external memory tx bd ring tx data buffer pointer to spi rx ring rx bd ring rx data buffer tx data buffer frame status data length data pointer
communication processor module 16-440 mpc823 reference manual motorola spi communication 16 processor module 16.12.4 programming the serial peripheral interface 16.12.4.1 spi mode register. the read/write spi mode (spmode) register controls both the serial peripheral interface operation mode and clock source. table 16-2 contains more information on commands that can be used with this register. bit 0reserved this bit is reserved and must be set to 0. looploop mode when set, this bit selects the local loopback operation. the transmitter output is internally connected to the receiver input. the receiver and transmitter operate normally, except that the externally received data is ignored. 0 = normal operation. 1 = the serial peripheral interface is in loopback mode. ciclock invert this bit inverts the spi clock polarity. see figure 16-122 and figure 16-123 for details. 0 = the inactive state of spiclk is low. 1 = the inactive state of spiclk is high. cpclock phase this bit selects one of two fundamentally different transfer formats. see figure 16-122 and figure 16-123 for details. 0 = spiclk starts toggling at the middle of the data transfer. 1 = spiclk starts toggling at the beginning of the data transfer. div16divide by 16 this bit selects the clock source for the spi baud rate generator when configured as an spi master. in slave mode, the clock source is the spiclk pin. 0 = use the brgclk as the input to the spi baud rate generator. 1 = use the brgclk/16 as the input to the spi baud rate generator. spmode bit 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 field res loop ci cp div16 rev m/s en len pm reset 00000000 0 0 r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w addr (immr & 0xffff0000) + 0xaa0
communication processor module motorola mpc823 reference manual 16-441 spi communication 16 processor module revreverse data this bit determines the receive and transmit character bit order. 0 = reverse data. least-significant bit of the character transmitted and received first. 1 = normal operation. most-significant bit of the character transmitted and received first. m/smaster/slave this bit configures the serial peripheral interface to operate as a master or slave. 0 = the serial peripheral interface is a slave. 1 = the serial peripheral interface is a master. enenable spi this bit enables serial peripheral interface operation. configure the spimosi, spimiso, spiclk, and spisel pins to connect to the serial peripheral interface, as described in section 16.14.6 the port b registers . when the en bit is cleared, the serial peripheral interface is in a reset state and consumes minimal power, which means the spi baud rate generator is not functioning and the input clock is disabled. 0 = the serial peripheral interface is disabled. 1 = the serial peripheral interface is enabled. lencharacter length this field specifies the number of bits in a character. these values must be between 4 and 16 bits. if you program a value less than 4 bits, erratic behavior will occur. if the value of len is less than or equal to a byte, there will be len number of valid bits in every byte (8 bits) in memory. on the other hand, if the value of len is greater than a byte, there is len number of valid bits in every half-word (16 bits) in memory. 0011 = 4-bit character length. 0100 = 5-bit character length. 0101 = 6-bit character length. 0110 = 7-bit character length. 0111 = 8-bit character length. ? ? ? 1111 = 16-bit character length. note: you must not modify other bits of the spmode register when the en bit is set.
communication processor module 16-442 mpc823 reference manual motorola spi communication 16 processor module pmprescale modulus select this field specifies the divide ratio of the prescale divider in the spi clock generator. the brgclk is divided by 4 * ([pm0Cpm3] + 1), thus giving a clock divide ratio of 4 to 64. the clock has a 50% duty cycle. 16.12.4.1.1 spi examples with different len values. the programming examples below illustrate the effect of the len field and the rev bit in the spmode register on output from the spi controller. they illustrate the master mode output from the spi controller as the len varies. to help map the output process, make g through v the binary symbols, use x to indicate a deleted bit, use __ to indicate original byte boundaries, and use _ to indicate original nibble (4-bit) boundaries. the initial pattern for all examples is ghij_klmn__opqr_stuv . example 1 len = 0x4 (data size = 5) data selected: xxxj_klmn_xxxr_stuv data transmitted for rev=0: nmlk_j__vuts_r data transmitted for rev=1: j_nmlk__r_stuv example 2 len = 0x7 (data size = 8) data selected: ghij_klmn_opqr_stuv data transmitted for rev=0: nmlk_jihg__vuts_rqpo data transmitted for rev=1: ghij_klmn__opqr_stuv example 3 len = 0xc (data size = 13) data selected: ghij_klmn_xxxr_stuv data transmitted for rev=0: nmlk_jihg__vuts_r data transmitted for rev=1: r_stuv__ghij_klmn example 4 len = 0xf (data size = 16) data selected: ghij_klmn_opqr_stuv data transmitted for rev=0: nmlk_jihg__vuts_rqpo data transmitted for rev=1: opqr_stuv__ghij_klmn
communication processor module motorola mpc823 reference manual 16-443 spi communication 16 processor module figure 16-122. spi transfer format if cp is set to 0 figure 16-123. spi transfer format if cp is set to 1 spiclk (ci = 0) spiclk (ci = 1) spimosi (from master) spimiso (from slave) spisel msb lsb msb lsb q note: q = undefined signal spiclk (ci = 0) spiclk (ci = 1) spimosi (from master) spimiso (from slave) spisel msb msb lsb lsb q note: q = undefined signal
communication processor module 16-444 mpc823 reference manual motorola spi communication 16 processor module 16.12.4.1.2 spi receive buffer descriptor. using receive (rx) buffer descriptors, the communication processor module reports information about each buffer of received data, closes the current buffer, generates a maskable interrupt, and starts receiving data in the next buffer once the current buffer is full. additionally, it closes the buffer when the serial peripheral interface is configured as a slave and the spisel pin goes inactive, thus indicating that the reception process has stopped. the first word of the rx buffer descriptor contains status and control bits that you prepare before reception and then the communication processor module sets them after the buffer is closed. the second word contains the data length (in bytes) that is received and the third and fourth words contain a pointer that always points to the beginning of the received data buffer. you must configure the rx buffer descriptor bits before the serial peripheral interface is enabled. eempty 0 = the data buffer associated with this rx buffer descriptor is filled with data or stops receiving data because an error occurred. the core is free to examine or write to any fields of this rx buffer descriptor, but the communication processor module does not use this buffer descriptor as long as the e bit is zero. 1 = the data buffer associated with this buffer descriptor is empty or is currently receiving data. this rx buffer descriptor and its associated receive buffer are owned by the communication processor module. once the e bit is set, the core must not write any fields of this rx buffer descriptor. bit 1, 5, and 7C13reserved these bits are reserved and must be set to 0. 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 offset + 0 e res wi l res cm reserved ov me offset + 2 data length offset + 4 rx data buffer pointer offset + 6 note: you are only responsible for initializing the items in bold. note: the communication processor module sets all the status bits in this buffer descriptor, but you must clear them before submitting the buffer descriptor to the communication processor module.
communication processor module motorola mpc823 reference manual 16-445 spi communication 16 processor module wwrap (final buffer descriptor in table) 0 = this is not the last buffer descriptor in the rx buffer descriptor table. 1 = this is the last buffer descriptor in the rx buffer descriptor table. after this buffer is used, the communication processor module receives incoming data into the first buffer descriptor that rbase points to in the table. the number of rx buffer descriptors in this table is programmable and determined only by the w bit and overall space constraints of the dual-port ram. iinterrupt 0 no interrupt is generated after this buffer is filled. 1 the rxb bit in the spie register is set when this buffer is completely filled by the communication processor module, indicating the need for the core to process the buffer. the rxb bit can cause an interrupt if it is enabled. cmcontinuous mode this bit is valid only when the serial peripheral interface is in master mode. in slave mode, it must be written as a zero. 0 = normal operation. 1 = the e bit is not cleared by the communication processor module after this buffer descriptor is closed, thus allowing the associated data buffer to be automatically overwritten next time the communication processor module accesses this buffer descriptor. this allows continuous reception from an spi slave into one buffer for autoscanning of a serial a/d peripheral with no core overhead. llast this bit is set by the serial peripheral interface when the buffer is closed because the spisel pin was negated. this only occurs when the serial peripheral interface is in slave mode. otherwise, the me bit is set. the serial peripheral interface writes this bit after the received data is placed into the associated data buffer. 0 = this buffer does not contain the last character of the message. 1 = this buffer contains the last character of the message. ovoverrun this bit indicates that a receiver overrun has occurred during reception. this can only occur when the serial peripheral interface is in slave mode. the serial peripheral interface writes this bit after the received data is placed into the associated data buffer. memultimaster error this bit indicates that this buffer is closed because the spisel pin was asserted when the serial peripheral interface was in master mode. this indicates a synchronization problem between multiple masters on the spi bus. the serial peripheral interface writes this bit after the received data is placed into the associated data buffer.
communication processor module 16-446 mpc823 reference manual motorola spi communication 16 processor module data length this field represents the number of octets that the communication processor module writes into this buffer descriptor data buffer. the communication processor module writes it once as the buffer descriptor is closed. the serial peripheral interface writes these bits after the received data is placed into the associated data buffer. the actual amount of memory allocated for this buffer must be greater than or equal to the mrblr entry. rx data buffer pointer this field always points to the first location of the associated data buffer. it must be even and it can reside in internal or external memory. the serial peripheral interface writes these bits after the received data is placed into the associated data buffer. 16.12.4.1.3 spi transmit buffer descriptor. data to be transmitted by the serial peripheral interface is sent to the communication processor module by arranging it in buffers referenced by the transmit (tx) buffer descriptor ring. the first word of the tx buffer descriptor contains status and control bits. you must prepare the following bits before transmitting data. rready 0 = the data buffer associated with this buffer descriptor is not ready for transmission and you are free to manipulate it or its associated data buffer. the communication processor module clears this bit after the buffer is transmitted or after an error occurs. 1 = the data buffer, which you prepare for transmission, is not transmitted yet or is currently being transmitted. you cannot write any fields of this buffer descriptor once this bit is set. bits 1, 5, and 7C13reserved these bits are reserved and must be set to 0. 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 offset + 0 r res wi l res cm reserved un me offset + 2 data length offset + 4 tx data buffer pointer offset + 6 note: you are only responsible for initializing the items in bold. note: the communication processor module sets all the status bits in this buffer descriptor, but you must clear them before submitting the buffer descriptor to the communication processor module.
communication processor module motorola mpc823 reference manual 16-447 spi communication 16 processor module wwrap (final buffer descriptor in table) 0 = this is not the last buffer descriptor in the tx buffer descriptor table. 1 = this is the last buffer descriptor in the tx buffer descriptor table. after this buffer is used, the communication processor module receives incoming data into the first buffer descriptor that tbase points to in the table. the number of tx buffer descriptors in this table is programmable and determined only by the w bit and overall space constraints of the dual-port ram. iinterrupt 0 = no interrupt is generated after this buffer is serviced. 1 = the txb or txe bit in the spi event register is set when this buffer is serviced. txb and txe can cause interrupts if they are enabled. llast 0 = this buffer does not contain the last character of the message. 1 = this buffer contains the last character of the message. cmcontinuous mode this bit is only valid when the serial peripheral interface is in master mode. in slave mode, it must be written as a zero. 0 = normal operation. 1 = the r bit is not cleared by the communication processor module after this buffer descriptor is closed, thus allowing the associated data buffer to be automatically retransmitted next time the communication processor module accesses this buffer descriptor. ununderrun this bit indicates that the serial peripheral interface has encountered a transmitter underrun condition while transmitting a data buffer. this error condition is only valid when the serial peripheral interface is in slave mode. the serial peripheral interface writes this bit after it finishes transmitting the associated data buffer. memultimaster error this bit indicates that this buffer is closed because the spisel pin was asserted when the serial peripheral interface was in master mode. this indicates a synchronization problem between multiple masters on the spi bus. the serial peripheral interface writes this bit after it finishes transmitting the associated data buffer.
communication processor module 16-448 mpc823 reference manual motorola spi communication 16 processor module data length this field indicates the number of octets that the communication processor module must transmit from this buffer descriptor data buffer. however, it is never modified by the communication processor module. normally, this value is greater than zero, but if the number of data bits in the character is greater than 8, then data length must be even. for example, to transmit three characters of 8-bit data, the data length field must be initialized to 3. however, to transmit three characters of 9-bit data the data length field must be initialized to 6, since the three 9-bit data fields occupy three half-words in memory. the serial peripheral interface writes these bits after it finishes transmitting the associated data buffer. tx data buffer pointer this field always points to the first location of the associated data buffer. they can be even or odd, unless the number of actual data bits in the character is greater than 8 bits, in which case the transmit buffer pointer must be even. the buffer can reside in internal or external memory. the serial peripheral interface writes these bits after it finishes transmitting the associated data buffer. 16.12.4.2 spi command register. the 8-bit read/write spi command (spcom) register is used to start serial peripheral interface operation. strstart transmit when the serial peripheral interface is configured as a master, setting this bit to 1 causes the serial peripheral interface to start transmitting and receiving data to and from the transmit/receive buffers if they are ready. when the serial peripheral interface is in slave mode, setting the str bit to 1 when the serial peripheral interface is idle causes the serial peripheral interface to load the transmit data register from the spi transmit buffer and start transmission as soon as the next spi input clocks and select signal are received. this bit is automatically cleared after one system clock cycle. bits 1C7reserved. these bits are reserved and must be set to 0. spcom bit 0 1 2 3 4 5 6 7 field str reserved reset 00 r/w r/w r/w addr (immr & 0xffff0000) + 0xaad
communication processor module motorola mpc823 reference manual 16-449 spi communication 16 processor module 16.12.4.3 spi event register. the 8-bit memory-mapped spi event (spie) register is used to generate interrupts and report events recognized by the serial peripheral interface. when an event is recognized, the serial peripheral interface sets the corresponding bit in this register. interrupts generated by this register can be masked in the spim register. a bit is cleared by writing a 1 (writing a zero has no effect) and more than one bit can be cleared at a time. however, all unmasked bits must be cleared before the communication processor module clears the internal interrupt request. this register is cleared by reset and can be read at any time. bits 0C1 and 4reserved these bits are reserved and must be set to 0. mmemulti-master error this bit indicates that the serial peripheral interface has discovered that the spisel pin was asserted externally while the serial peripheral interface was in master mode. txetx error this bit indicates that an error has occurred during transmission. bsybusy condition this bit indicates that received data has been discarded due to a lack of buffers. this bit is set after the first character is received for which there is no receive buffer. txbtx buffer this bit indicates that a buffer has been transmitted. it is set once the transmit data of the last character in the buffer is written to the transmit fifo. you must wait two character times to be sure that the data is completely sent over the transmit pin. rxbrx buffer this bit indicates that a buffer has been received. it set after the last character is written to the receive buffer and the rx buffer descriptor is closed. spie bit 0 1 2 3 4 5 6 7 field reserved mme txe res bsy txb rxb reset 0 000000 r/w r/w r/w r/w r/w r/w r/w r/w addr (immr & 0xffff0000) + 0xaa6
communication processor module 16-450 mpc823 reference manual motorola spi communication 16 processor module 16.12.4.4 spi mask register. the 8-bit read/write spi mask (spim) register has the same bit formats as the spie register. if a bit in the spim is 1, the corresponding interrupt in the spie register is enabled. if the bit is zero, the corresponding interrupt in the spie register is masked. this register is cleared by reset. 16.12.5 spi master programming example the following is an example initialization sequence using the serial peripheral interface in master mode at high speed. 1. configure the port b pins to enable the spimosi, spimiso, and spiclk pins. write pbpar and pbdir bits 30, 29, and 28 with ones and then pbodr bits 30, 29, and 28 with zeros. 2. configure a parallel i/o pin to operate as the serial peripheral interface select pin if needed. if pb16 is chosen, write pbodr bit 16 with a zero, pbdir bit 16 with a one, and pbpar bit 16 with a zero. then write pbdat bit 16 with a zero to constantly assert the select pin. 3. write rbase and tbase in the spi parameter ram to point to the rx buffer descriptor and tx buffer descriptor in the dual-port ram. assuming one rx buffer descriptor is at the beginning of the dual-port ram and one tx buffer descriptor follows that rx buffer descriptor, write rbase with 0x2000 and tbase with 0x2008. 4. program the cpm command register (cpcr) to execute the init rx and tx params command. write 0x0051 to the cpcr. 5. write 0x0001 to the sdcr to initialize the sdma configuration register. 6. write 0x18 to rfcr and tfcr for normal operation. 7. write mrblr with the maximum number of bytes per receive buffer. in this case, assume 16 bytes, so mrblr = 0x0010. 8. initialize the rx buffer descriptor and assume the rx data buffer is at 0x00001000 in main memory. write 0xb000 to rx_bd_status, 0x0000 to rx_bd_length (optional), and 0x00001000 to rx_bd_pointer. spim bit 0 1 2 3 4 5 6 7 field reserved mime txe res bsy txb rxb reset 0 000000 r/w r/w r/w r/w r/w r/w r/w r/w addr (immr & 0xffff0000) + 0xaaa note: for multimaster operation, enable the spisel pin to internally connect to the serial peripheral interface.
communication processor module motorola mpc823 reference manual 16-451 spi communication 16 processor module 9. initialize the tx buffer descriptor and assume the tx data buffer is at 0x00002000 in main memory and contains five 8-bit characters. write 0xb800 to tx_bd_status, 0x0005 to tx_bd_length, and 0x00002000 to tx_bd_pointer. 10. write 0xff to the spie register to clear any previous events. 11. write 0x37 to the spim register to enable all possible serial peripheral interface interrupts. 12. write 0x00000020 to the cimr to allow the serial peripheral interface to generate a system interrupt. the cicr must also be initialized. 13. write 0x0370 to the spmode register to enable normal operation (not loopback), master mode, serial peripheral interface enabled, 8-bit characters, and the fastest speed possible. 14. set the str bit in the spcom register to start the transfer. 16.12.6 spi slave programming example the following is an example initialization sequence to follow when the serial peripheral interface is in slave mode. it is very similar to the master example, except that the spisel pin is used instead of a general-purpose i/o pin. 1. configure the port b pins to enable the spimosi, spimiso, spisel , and spiclk pins. write pbpar bits 31, 30, 29, and 28 with ones and the pbodr bits 31, 30, 29, and 28 with zeros. write pbdir bits 30, 29, and 28 with ones and bit 31 with zero. 2. write rbase and tbase in the spi parameter ram to point to the rx and tx buffer descriptor in the dual-port ram. assuming one rx buffer descriptor at the beginning of the dual-port ram and one tx buffer descriptor following that rx buffer descriptor, write rbase with 0x2000 and tbase with 0x2008. 3. write 0x18 to rfcr and tfcr for normal operation. 4. program the cpm command register (cpcr) to execute the init rx and tx params command. write 0x0051 to the cpcr. 5. write 0x0001 to the sdcr to initialize the sdma configuration register. 6. write mrblr with the maximum number of bytes per receive buffer. assume 16 bytes, so mrblr = 0x0010. 7. initialize the rx buffer descriptor and assume the rx data buffer is at 0x00001000 in main memory. write 0xb000 to rx_bd_status, 0x0000 to rx_bd_length (optional), and 0x00001000 to rx_bd_pointer. 8. initialize the tx buffer descriptor and assume the tx data buffer is at 0x00002000 in main memory and contains five 8-bit characters. write 0xb800 to tx_bd_status, 0x0005 to tx_bd_length, and 0x00002000 to tx_bd_pointer. note: after 5 bytes are transmitted, the tx buffer descriptor is closed. additionally, the receive buffer is closed after 5 bytes are received because the l bit of the tx buffer descriptor is set.
communication processor module 16-452 mpc823 reference manual motorola spi communication 16 processor module 9. write 0xff to the spie register to clear any previous events. 10. write 0x37 to the spim register to enable all possible serial peripheral interface interrupts. 11. write 0x00000020 to the cimr to allow the serial peripheral interface to generate a system interrupt. the cicr must also be initialized. 12. write 0x0170 to the spmode register to enable normal operation (not loopback), master mode, and 8-bit characters. the spi baud rate generator speed is ignored because the serial peripheral interface is in slave mode. 13. set the str bit in the spcom register to enable the serial peripheral interface to be ready once the master begins the transfer. 16.12.7 handling interrupts in the spi the following sequence must be followed to handle interrupts in the serial peripheral interface. 1. once an interrupt occurs, read the spie register to discover the cause of the interrupts. normally, the spie bits must be cleared at this time. 2. process the tx buffer descriptor to reuse it and the rx buffer descriptor to extract the data from it. to transmit another buffer, simply set the r bit of the tx buffer descriptor, the e bit of the rx buffer descriptor, and the str bit of the spcom register. 3. clear the spi bit in the cisr. 4. execute the rfi instruction. note: if the master transmits 3 bytes and negates the spisel pin, the rx buffer descriptor is closed, but the tx buffer descriptor remains open. if the master transmits 5 or more bytes, the tx buffer descriptor is closed after the fifth byte. if the master transmits 16 bytes and negates the spisel pin, the rx buffer descriptor is closed with no errors and no out-of-buffer error occurs. if the master transmits more than 16 bytes, the rx buffer descriptor is closed (completely full) and the out-of-buffer error occurs after the 17th byte is received.


▲Up To Search▲   

 
Price & Availability of MPC823UMREV116-CPM7

All Rights Reserved © IC-ON-LINE 2003 - 2022  

[Add Bookmark] [Contact Us] [Link exchange] [Privacy policy]
Mirror Sites :  [www.datasheet.hk]   [www.maxim4u.com]  [www.ic-on-line.cn] [www.ic-on-line.com] [www.ic-on-line.net] [www.alldatasheet.com.cn] [www.gdcy.com]  [www.gdcy.net]


 . . . . .
  We use cookies to deliver the best possible web experience and assist with our advertising efforts. By continuing to use this site, you consent to the use of cookies. For more information on cookies, please take a look at our Privacy Policy. X